Search code examples
ruby-on-railsupdate-attributesupdate-attribute

update_attribute/s() is calling callback for save password


I'm trying to update single attribute of a user model from a admin controller (not users controller).

While doing this I tried update_attribute() but it was changing the users password also.

I think the password is changing because I have before_save method on user model which hashes the password.

update_attributes() is not working because it is checking the validations for password which is presence=>true

Is there any way to achieve this?


Solution

  • Try update_column(name, value), it might work.