[Error][Rails 4] Undefined method `attr_accessible'

33 views
Skip to first unread message

Ricardo Liyushiro Chikasawa

unread,
Aug 13, 2014, 4:23:53 PM8/13/14
to rubyonra...@googlegroups.com
Hi Guy,

I'm a beginner with Ruby on Rails.

I insert new colum

rails generate migration add_premium_to_jobs premium:boolean

after

rake db:migrate

And add in model -> job.rb ,the attribute attr_accessible :premium

Console error : undefined method `attr_accessible'

Can Help me?

Regards
Chikaawa

Frederick Cheung

unread,
Aug 14, 2014, 4:38:34 AM8/14/14
to rubyonra...@googlegroups.com


On Wednesday, August 13, 2014 9:23:53 PM UTC+1, Ricardo Liyushiro Chikasawa wrote:
And add in model -> job.rb ,the attribute attr_accessible :premium

Console error : undefined method `attr_accessible'

Can Help me?

attr_accessible and attr_protected were removed in rails 4. You can get them back with the protected_attributes gem but the recommendation is to use strong parameters instead.

Fred 
Reply all
Reply to author
Forward
0 new messages