Railsチュートリアルの14章を進めているのですが、rails db:migrate:reset後にrails db:seedをすると下記のようなエラーが出てしまいます。どのようにしたらこのエラーを解消できるか教えていただけると助かります。
$ rails db:seed rails aborted! ActiveModel::UnknownAttributeError: unknown attribute 'activated' for User. /Users/sh/Desktop/rails_tutorial/sample_app/db/seeds.rb:2:in `<top (required)>' /Users/sh/Desktop/rails_tutorial/sample_app/bin/rails:9:in `require' /Users/sh/Desktop/rails_tutorial/sample_app/bin/rails:9:in `<top (required)>' /Users/sh/Desktop/rails_tutorial/sample_app/bin/spring:15:in `<top (required)>' bin/rails:3:in `load' bin/rails:3:in `<main>' Tasks: TOP => db:seed
seeds
1# ユーザー 2User.create!(name: "Example User", 3 email: "example@railstutorial.org", 4 password: "foobar", 5 password_confirmation: "foobar", 6 admin: true, 7 activated: true, 8 activated_at: Time.zone.now) 9 1099.times do |n| 11 name = Faker::Name.name 12 email = "example-#{n+1}@railstutorial.org" 13 password = "password" 14 User.create!(name: name, 15 email: email, 16 password: password, 17 password_confirmation: password, 18 activated: true, 19 activated_at: Time.zone.now) 20end 21 22# マイクロポスト 23users = User.order(:created_at).take(6) 2450.times do 25 content = Faker::Lorem.sentence(5) 26 users.each { |user| user.microposts.create!(content: content) } 27end 28 29# リレーションシップ 30users = User.all 31user = users.first 32following = users[2..50] 33followers = users[3..40] 34following.each { |followed| user.follow(followed) } 35followers.each { |follower| follower.follow(user) }
rails
1#!/usr/bin/env ruby 2begin 3load File.expand_path('../spring', __FILE__) 4rescue LoadError => e 5 raise unless e.message.include?('spring') 6end 7APP_PATH = File.expand_path('../config/application', __dir__) 8require_relative '../config/boot' 9require 'rails/commands'
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/11/25 01:19
2019/11/25 02:57
2019/11/25 03:40