Is there a replacement for update_attribute
? I know you can still use it in Rails 3 but you get deprecation messages.
The reason why I need to use update_attribute
is because I need to skip validations but run callbacks.
The only way that I've found of doing this (and avoid deprecation messages), is by simply extracting the code from update_attribute
:
Object.send("#{attribute}=", value)
Object.save(:validate => false)
I'd like to know if there is another (proper) way of doing this.
Thanks.
I would suggest what the answer is no.
You cannot pass false
to update_attributes
to skip validation.
I would recommend you update_column, but this method skip callbacks. And judging by you question it isn't what you need.
Update:
I've found interesting table in that presentation. That I guess can prove my opinion.
Judging by this table there is only one method which satisfies the conditions.