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

I need some help with my ruby on rails application

I am following along with the ruby on rails tutorial. I am at the point where i can get to the sign_up page but when i click sign_up, i get this error:


ActiveModel::MassAssignmentSecurity::Error in Devise::RegistrationsController#create

Can't mass-assign protected attributes: email, password, password_confirmation

{"utf8"=>"?",
 "authenticity_token"=>"yEcNIsbuzGc44hS+T19eq/YOTB8BSbv1g2GG8luDL+4=",
 "user"=>{"email"=>"",
 "password"=>"[FILTERED]",
 "password_confirmation"=>"[FILTERED]"},
 "commit"=>"Sign up"}

Any ideas why this is happening. I need to resolve this issue to i can move on. Thanks!

2 Answers

Did you try going to the user.rb file and adding :email, :password, and :password_confirmation to attr_accessibile?

I tried this and it didn't work. ); Any other ideas?

your problem and its solution is in this video tutorial on Treehouse itself!

here is the link:

http://teamtreehouse.com/library/programming/build-a-simple-ruby-on-rails-application/creating-an-authentication-system/generating-the-devise-views

I also had trouble even after following the video,so I also added this gem to the application gem file (after the devise gem ) :

gem 'protected_attributes'

then you have to : 1-stop your rails server (using ctrl +c) from the console> :2- run bundle on the command line to install the above mentioned gem.

When you restart the rails server and refresh the page in the browser this error will disappear,but the next error mentioned in the video will show up , so you just follow the instructions given again and you should be fine.