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.


Lee Hughes
Lee Hughes
8,380 Points

Generating the Devise Views (Rails 4.0) attr_accessible

I'm going through the video


Jason says to use the following code for the error to stop working.

attr_accessible :email, :password, :password_confirmation, :remember_me,
              :first_name, :last_name, :profile_name

However, I'm using Rails 4.0 and the attr_accessible isn't used by Rails 4.0.

Is it safe to assume that the steps as mentioned in the video aren't needed with Rails 4.0?

Everything works fine without the code in the video but as Jason mentions there might be security problems with users making their roles admin.

2 Answers

Roberto Alicata
Roberto Alicata
Courses Plus Student 39,959 Points

you can try to add this in the application_controller.rb

  before_action :configure_permitted_parameters, if: :devise_controller?


  def configure_permitted_parameters
    devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:first_name, :last_name, :profile_name, :email, :password, :password_confirmation) }
Lee Hughes
Lee Hughes
8,380 Points

Never mind - continuing with rails 4.0 installed I ran into a lot of problems later in the course. I had to delete my progress and start again with older rails version. :(