diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-07-02 20:27:10 -0700 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-07-02 20:27:10 -0700 |
commit | 55456ad34ac2be56392bce074577ebc0aeb509b2 (patch) | |
tree | d6f9857f7b6f2e5f288a1fe89a7fe9dd9b9e9d7f /activerecord/lib/active_record | |
parent | 215d41d802637520129cb7551b35faca72873143 (diff) | |
parent | 9196b93111b5f89f030b089d32d7a3a9d49b0df9 (diff) | |
download | rails-55456ad34ac2be56392bce074577ebc0aeb509b2.tar.gz rails-55456ad34ac2be56392bce074577ebc0aeb509b2.tar.bz2 rails-55456ad34ac2be56392bce074577ebc0aeb509b2.zip |
Merge pull request #6934 from kennyj/fix_store
Don't mark the store as changed if an attribute isn't changed.
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/store.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/store.rb b/activerecord/lib/active_record/store.rb index d13491502e..2af5b02fb7 100644 --- a/activerecord/lib/active_record/store.rb +++ b/activerecord/lib/active_record/store.rb @@ -58,8 +58,11 @@ module ActiveRecord keys.each do |key| define_method("#{key}=") do |value| initialize_store_attribute(store_attribute) - send(store_attribute)[key] = value - send :"#{store_attribute}_will_change!" + attribute = send(store_attribute) + if value != attribute[key] + attribute[key] = value + send :"#{store_attribute}_will_change!" + end end define_method(key) do |