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 trial

Ruby Build a Simple Ruby on Rails Application Creating an Authentication System Generating the Devise Views

Alessandro Treglia
Alessandro Treglia
4,537 Points

Attr_accessible problem

In the user.rb file on the video there is already a generated line for attr_accessible with a few variables. When I look at my user.rb file it only shows..

class User < ActiveRecord::Base # Include default devise modules. Others available are: # :confirmable, :lockable, :timeoutable and :omniauthable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable

when I add the attr_accessible and the variables and then run the server I get this error.

attr_accessibleis extracted out of Rails into a gem. Please use new recommended protection model for params(strong_parameters) or addprotected_attributes` to your Gemfile to use old one.

What do I need to do to get this to work?

Thank you

1 Answer

Brandon Barrette
Brandon Barrette
20,485 Points

I would use strong_parameters that comes with rails 4. It was changed for security purposes. Search the forums here for info about that (it's been asked dozens of times).

Otherwise switch to rails 3.2.13 which is the version used in the Treebook videos.

Here's one of those older threads.