diff options
author | Jonathan del Strother <jon.delStrother@audioboo.fm> | 2013-12-24 17:23:47 +0000 |
---|---|---|
committer | Jonathan del Strother <jon.delStrother@audioboo.fm> | 2013-12-27 15:54:06 +0000 |
commit | b7bf025374324c2b73b3ab270cd4153f18a942b0 (patch) | |
tree | dee9ff4133a497b0ebbf2ab93cae3fe604a97014 /activerecord/lib | |
parent | df09ce966e41b53b3d5723c4efb1e7470c452dd8 (diff) | |
download | rails-b7bf025374324c2b73b3ab270cd4153f18a942b0.tar.gz rails-b7bf025374324c2b73b3ab270cd4153f18a942b0.tar.bz2 rails-b7bf025374324c2b73b3ab270cd4153f18a942b0.zip |
Copy changed_attributes across to newly become'd records
Without this, the original record's values won't get saved, since the partial insertions support (https://github.com/rails/rails/commit/144e8691cbfb8bba77f18cfe68d5e7fd48887f5e) checks for changed values and thinks there are none.
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/persistence.rb | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/persistence.rb b/activerecord/lib/active_record/persistence.rb index 35fbad466e..38264cdb7d 100644 --- a/activerecord/lib/active_record/persistence.rb +++ b/activerecord/lib/active_record/persistence.rb @@ -181,6 +181,7 @@ module ActiveRecord became = klass.new became.instance_variable_set("@attributes", @attributes) became.instance_variable_set("@attributes_cache", @attributes_cache) + became.instance_variable_set("@changed_attributes", @changed_attributes) became.instance_variable_set("@new_record", new_record?) became.instance_variable_set("@destroyed", destroyed?) became.instance_variable_set("@errors", errors) |