when i write in cmd "rake db:seed", then i got this error:
rake aborted!
ActiveModel::UnknownAttributeError: unknown attribute 'status' for Recording. G:/program/Rails/weather/db/seeds.rb:2:in `' Tasks: TOP => db:seed (See full trace by running task with --trace)
That is my "seeds.rb" code
`l = Location.create(name: "New York City")
l.recordings.create(temp: 32, status: "cloudy")
l.recordings.create(temp: 34, status: "rainy")
l.recordings.create(temp: 30, status: "rainy")
l.recordings.create(temp: 28, status: "cloudy")
l.recordings.create(temp: 22, status: "sunny")`
You are missing status
attribute in your migration for Recording
model.
Follow these steps from terminal:
# add `status` column in `recordings` table
rails generate migration AddStatusToRecording status:string
rake db:migrate
# seed the data into the db
rake db:seed
Hope it will help.