I have a Model with some attributes: attr1, attr2 and attr3. I need to update this attributes without execute callbacks and validations. I found update_column method but I want to update the three attributes at the same time. I need something like:
update_columns({attr1: val1, attr2: val2, attr3: val3})
instead
update_column(attr1, val1)
update_column(attr2, val2)
update_column(attr3, val3)
You can use update_columns(attr1: val1, attr2: val2, attr3: val3)
as documented here. You just need to pass in the key-value pairs, not an actual hash object.
Try this:
update_attributes!(attr1: val1, attr2: val2, attr3: val3)
Perhaps without the !
, but I think that is needed.
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