I'm creating seed data for one of my tables and whenever I run rake db:seed it gives me the error:
Can't mass-assign protected attributes: severity
My two models look like
class Status < ActiveRecord::Base
belongs_to :severity
attr_accessible :description, :image, :name, :slug, :severity_id
end
and
class Severity < ActiveRecord::Base
attr_accessible :name, :val, :severity_id
end
the data I'm trying to seed with is
statuses = Status.create(
[
{
"name"=> 'Normal',
"slug"=> 'normal',
"description"=> 'The service is up or was up during this entire period',
"severity"=> 1,
"image"=> 'tick-circle'
}
]
)
Why does this happen?