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
Tim Luchtefeld
1,183 PointsSign up with Devise
When trying to generate user model in ruby on rails i can get the page to where I am supposed to sign up. However after I put in my email and password the error keeps saying
"Can't mass-assign protected attributes: email, password, password_confirmation"
"{"utf8"=>"?", "authenticity_token"=>"0B2ypfWLMQODJlePb8AUdfJSYAyUL3tj2r5Z90t5fJk=", "user"=>{"email"=>"luchteft@uni.edu", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]"}, "commit"=>"Sign up"}"
Any feedback would be awesome. thank you!
missgeekbunny
37,033 Pointslol that's the fix that's in the videos to fix issues like that. If you can't mass assign you need to change the model.
2 Answers
Tim Luchtefeld
1,183 PointsThank you very much for the feedback however now I am receiving this error
SyntaxError in Devise::RegistrationsController#new
C:/Sites/treebook/app/models/user.rb:12: syntax error, unexpected keyword_end
and this is the text i have in sublime
class User < ActiveRecord::Base # Include default devise modules. Others available are: # :token_authenticatable, :confirmable, # :lockable, :timeoutable and :omniauthable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable
# Setup accessible (or protected) attributes for your model attr_accessible :email, :password, :password_confirmation, :remember_me, :first_name, :last_name, :profile_name, # attr_accessible :title, :body end
Jason Seifer
Treehouse Guest TeacherHey @Tim Luchtefeld you may have an extra "end" somewhere in your User model. Try hunting around to see if anything looks out of place.
Steve Monsen
5,207 PointsSteve Monsen
5,207 PointsThis is covered in a future video by Jim (I think it's the next one). Anyway, the way I got around it is to add those attributes to the user model:
/app/models/user.rb attr_accessible :email, :password, :password_confirmation, :remember_me, :first_name, :last_name, :profile_name