diff options
author | Mike Busch <mbusch@heroku.com> | 2017-01-23 12:09:14 -0500 |
---|---|---|
committer | Mike Busch <mbusch@heroku.com> | 2017-12-22 07:41:33 -0500 |
commit | c53287b2370af2b011cdc4c583a50fbcd6fd88ed (patch) | |
tree | dbd665902c1f6ec070f057a8b063923e12b4a2d3 /activerecord/lib/active_record/persistence.rb | |
parent | 0901755283645be1a59d625deb3471c40d664712 (diff) | |
download | rails-c53287b2370af2b011cdc4c583a50fbcd6fd88ed.tar.gz rails-c53287b2370af2b011cdc4c583a50fbcd6fd88ed.tar.bz2 rails-c53287b2370af2b011cdc4c583a50fbcd6fd88ed.zip |
save attributes changed by callbacks after update_attribute
update_attribute previously stopped execution, before saving and before
running callbacks, if the record's attributes hadn't changed. [The
documentation](http://api.rubyonrails.org/classes/ActiveRecord/Persistence.html#method-i-update_attribute)
says that "Callbacks are invoked", which was not happening if the
persisted attributes hadn't changed.
Diffstat (limited to 'activerecord/lib/active_record/persistence.rb')
-rw-r--r-- | activerecord/lib/active_record/persistence.rb | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/persistence.rb b/activerecord/lib/active_record/persistence.rb index a13b0d0181..462e5e7aaf 100644 --- a/activerecord/lib/active_record/persistence.rb +++ b/activerecord/lib/active_record/persistence.rb @@ -402,11 +402,7 @@ module ActiveRecord verify_readonly_attribute(name) public_send("#{name}=", value) - if has_changes_to_save? - save(validate: false) - else - true - end + save(validate: false) end # Updates the attributes of the model from the passed-in hash and saves the |