Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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.