Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialJeff Stringer
4,602 PointsGenerating the Devise Views Error
Hi,
I attempted to update the app/models/user.rb file. The user.rb file did not contain the following code which I added:
Setup accessible (or protected) attributes for your model
attr_accessible :email, :password, :password_confirmation, :remember_me, :first_name, :last_name, :profile_name # attr_accessible :title, :body
I then received the following error in my browser:
RuntimeError
attr_accessible
is extracted out of Rails into a gem. Please use new recommended protection model for params(strong_parameters) or add protected_attributes
to your Gemfile to use old one.
Extracted source (around line #8): 6 7 8 9 10 11
# Setup accessible (or protected) attributes for your model
attr_accessible :email, :password, :password_confirmation, :remember_me,
:first_name, :last_name, :profile_name
# attr_accessible :title, :body
end
Application Trace | Framework Trace | Full Trace
app/models/user.rb:8:in <class:User>'
app/models/user.rb:1:in
<top (required)>'
config/routes.rb:2:in block in <top (required)>'
config/routes.rb:1:in
<top (required)>'
I am stuck on what is meant by using the protection model or adding the 'protected_attributes' to the Gemfile.
Any ideas?
3 Answers
Daniel Terreros
Courses Plus Student 6,178 PointsAre you using rails 4?
Jeff Stringer
4,602 PointsHi Daniel - thanks, yes I'm using Rails 4.0.0
Daniel Terreros
Courses Plus Student 6,178 Pointsattr_accessible is no longer used in rails 4.
Strong Parameters for rails 4 is not covered in a video, here is a thread I'm in with two ways of doing it
You can check my code out at VanDanny on github. (The project name is BUZZ KC).