ruby - Rails devise customization -
The will of the user table I'm trying to save email and password through a different controller, but in the server I'm getting this error in the log,
Warning: User protected attributes can not be assigned: encrypted_password ---------------- ------- ------------------------------------------- ------- ----- (0.1ms) Initial user exists (0.4ms) from `users` where` users`.email` = binary 'mail@mail.com' border1 (0.2ms ) ROLLBACK as one.
So I'm not able to put it in the user table. And, how to encrypt the password? . Thinking is made in the gem
Controller:
@user = User.new (: Email = & gt; Parameter [: Supplier] [: User Name],: user name = & gt; parameter [: supplier] [: user name],: encrypted_password = & gt; '$ 2a $ 10 $ / Hh7UegsWm2ndRXbDEfjvOKBUiI1fa / z1GIbE5OYFpyqW6P97llsG') @ user.save puts @ user.errors Model: attr_accessible: encrypted_password
After
I will just use
users = users .new (email: "...", password: "pass Rd ", password_confirmation:" password ") user.skip_confirmation! user.save! In this way, the plan will work for you, and you will not have to worry about the confirmation email if you want the confirmation email to still exit, the other Remove row
Comments
Post a Comment