diff options
author | Arthur Nogueira Neves <github@arthurnn.com> | 2015-03-07 18:56:24 -0500 |
---|---|---|
committer | Arthur Nogueira Neves <github@arthurnn.com> | 2015-03-07 18:56:24 -0500 |
commit | 095f4c9da36ef7ca50d2799420f4f058afce112b (patch) | |
tree | 94bd8beddd5da2c8a8198485fbc982480aa43b0f /activerecord/lib | |
parent | 96b8f401f58e9ed4ea41aa32a2b34850640ac0d7 (diff) | |
parent | caae79a385ce112245262a17414bcd96bea013c2 (diff) | |
download | rails-095f4c9da36ef7ca50d2799420f4f058afce112b.tar.gz rails-095f4c9da36ef7ca50d2799420f4f058afce112b.tar.bz2 rails-095f4c9da36ef7ca50d2799420f4f058afce112b.zip |
Merge pull request #18200 from brainopia/rollback_frozen_records
Fix rollback of frozen records
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/transactions.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/transactions.rb b/activerecord/lib/active_record/transactions.rb index ffe7c4ae42..514dd1f2f3 100644 --- a/activerecord/lib/active_record/transactions.rb +++ b/activerecord/lib/active_record/transactions.rb @@ -356,6 +356,7 @@ module ActiveRecord if has_transactional_callbacks? self.class.connection.add_transaction_record(self) else + sync_with_transaction_state set_transaction_state(self.class.connection.transaction_state) end remember_transaction_record_state @@ -413,13 +414,14 @@ module ActiveRecord transaction_level = (@_start_transaction_state[:level] || 0) - 1 if transaction_level < 1 || force restore_state = @_start_transaction_state - thaw unless restore_state[:frozen?] + thaw @new_record = restore_state[:new_record] @destroyed = restore_state[:destroyed] pk = self.class.primary_key if pk && read_attribute(pk) != restore_state[:id] write_attribute(pk, restore_state[:id]) end + freeze if restore_state[:frozen?] end end end |