I have a simple problem. I want to change some field value for my User.find(1)
in rails console.
I tried:
u = User.find(1) u.update_attributes(roles_mask: 3)
And got false
returned. When I check u.errors.full_messages
, I see that it's because there is a problem with password validation from has_secure_password
. How can I update it manually in the console?
if you want to bypass validation, use
# skip validations but run callbacks u.update_attribute :roles_mask, 3
or
# do the update on the sql so no validation and callback is executed u.update_column :roles_mask, 3
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With