Is there a shorter way for this in Rails 3?
user.update_column(:attribute1, value1)
user.update_column(:attribute2, value2)
user.update_column(:attribute3, value3)
user.update_column(:attribute4, value4)
I tried update_columns
but it's only available in Rails 4.
Thanks for any help.
Here's a workaround for Rails 3.x:
User.where(id: user.id).update_all(attribute1: value1, attribute2: value2, ...)
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