diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-05-07 17:39:46 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-05-07 17:39:46 -0300 |
commit | 73fb39b6faa9de593ae75ad4e3b8e065ea0e53af (patch) | |
tree | 442bcf6ce4f31d2527ae3851e1345b7a6e28fc07 /activerecord/lib/active_record/transactions.rb | |
parent | 37c1e47da09fba4ee76143da05bbd4faabbaa53e (diff) | |
parent | 37c238927fbed059de3f26a90d8923fb377568a5 (diff) | |
download | rails-73fb39b6faa9de593ae75ad4e3b8e065ea0e53af.tar.gz rails-73fb39b6faa9de593ae75ad4e3b8e065ea0e53af.tar.bz2 rails-73fb39b6faa9de593ae75ad4e3b8e065ea0e53af.zip |
Merge branch 'rm-trasaction-fix-13166'
Diffstat (limited to 'activerecord/lib/active_record/transactions.rb')
-rw-r--r-- | activerecord/lib/active_record/transactions.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/transactions.rb b/activerecord/lib/active_record/transactions.rb index 17f76b63b3..cf76d53bf7 100644 --- a/activerecord/lib/active_record/transactions.rb +++ b/activerecord/lib/active_record/transactions.rb @@ -350,6 +350,7 @@ module ActiveRecord end @_start_transaction_state[:level] = (@_start_transaction_state[:level] || 0) + 1 @_start_transaction_state[:frozen?] = @attributes.frozen? + @_start_transaction_state[:changed_attributes] ||= changed_attributes end # Clear the new record state and id of a record. @@ -368,6 +369,9 @@ module ActiveRecord @attributes = @attributes.dup if @attributes.frozen? @new_record = restore_state[:new_record] @destroyed = restore_state[:destroyed] + changed_attributes.replace(restore_state[:changed_attributes]).delete_if do |attribute, old_value| + old_value == @attributes[attribute] + end if restore_state.has_key?(:id) write_attribute(self.class.primary_key, restore_state[:id]) else |