From 40496430d5825f55d1b8aa063f6642b82f6c65d5 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Mon, 22 Oct 2012 16:48:09 -0700 Subject: frozen state should be restored after txn is aborted --- activerecord/lib/active_record/transactions.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'activerecord/lib') diff --git a/activerecord/lib/active_record/transactions.rb b/activerecord/lib/active_record/transactions.rb index 934393b4e7..f91abfbd19 100644 --- a/activerecord/lib/active_record/transactions.rb +++ b/activerecord/lib/active_record/transactions.rb @@ -328,6 +328,7 @@ module ActiveRecord @_start_transaction_state[:new_record] = @new_record @_start_transaction_state[:destroyed] = @destroyed @_start_transaction_state[:level] = (@_start_transaction_state[:level] || 0) + 1 + @_start_transaction_state[:frozen?] = @attributes.frozen? end # Clear the new record state and id of a record. @@ -342,8 +343,8 @@ module ActiveRecord @_start_transaction_state[:level] = (@_start_transaction_state[:level] || 0) - 1 if @_start_transaction_state[:level] < 1 || force restore_state = @_start_transaction_state - was_frozen = @attributes.frozen? - @attributes = @attributes.dup if was_frozen + was_frozen = restore_state[:frozen?] + @attributes = @attributes.dup if @attributes.frozen? @new_record = restore_state[:new_record] @destroyed = restore_state[:destroyed] if restore_state.has_key?(:id) -- cgit v1.2.3