I'm still a beginner with Rails and have searched for an answer for awhile. I'm using Devise for authentication in my app and want users to be able to update their account information without using the current password. I have already looked at the Devise documentation on allowing users to edit their account without providing a password .
In doing so I will encounter a couple errors. Regardless of which controller setup (provided by the documentation) I use when submitting account updates, I get this:
Can't mass-assign protected attributes: current_password
So, I go to my User model and add :current_password to attr_accessible. Then when submitting updates, I'll see this:
unknown attribute: current_password
So, I'm stuck. I can't figure out what the deal is. I'm 90% sure I have routes.rb set up correctly (again, following the documentation). I'm thinking that if I didn't, these error messages wouldn't even appear.
从app/views/device/registrations/edit.html.erb
删除行<%= f.input :current_password %>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.