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 trialSreesh Reddy
1,928 PointsGenerating a User Model
When I try to enter in my email address, password, and password confirmation, the site gives me the folowing:
ActiveModel::MassAssignmentSecurity::Error in Devise::RegistrationsController#create
Can anyone tell me what's going on?
2 Answers
Zachary Stites
3,130 PointsI believe you have to go under Models > user.rb and before the "end" put the following --->
attr_accessible :email, :password, :password_confirmation
and if you get any other errors like that just go back and add the new part to the end. For instance, if the "remember me" tab is giving you errors. It would now look like this
attr_accessible :email, :password, :password_confirmation, :remember_me
Kingsley Ijomah
Courses Plus Student 648 PointsEvery attribute sent to the model for save needs to be whitelisted for security reasons, so as @Zachary said you add it to attr_accessible, then it becomes whitelisted, you then repeat this for every new attribute.
David Woody
8,671 PointsDavid Woody
8,671 PointsThis worked for me. Thanks!