aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2012-10-22 16:48:09 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2012-10-22 16:55:57 -0700
commitf7c2a8114136dd872e9d81aa16e93b9b9a148b0b (patch)
tree0b0ccae425696e0a0ed208aecf9ede7fd35d206a /activerecord/lib/active_record
parent247127193794fb239e23b544297accf63b7ad4fc (diff)
downloadrails-f7c2a8114136dd872e9d81aa16e93b9b9a148b0b.tar.gz
rails-f7c2a8114136dd872e9d81aa16e93b9b9a148b0b.tar.bz2
rails-f7c2a8114136dd872e9d81aa16e93b9b9a148b0b.zip
frozen state should be restored after txn is aborted
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/transactions.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/transactions.rb b/activerecord/lib/active_record/transactions.rb
index 1b14df70e0..d0b51ef6a7 100644
--- a/activerecord/lib/active_record/transactions.rb
+++ b/activerecord/lib/active_record/transactions.rb
@@ -329,6 +329,7 @@ module ActiveRecord
@_start_transaction_state[:destroyed] = @destroyed
end
@_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.
@@ -345,8 +346,8 @@ module ActiveRecord
@_start_transaction_state[:level] = (@_start_transaction_state[:level] || 0) - 1
if @_start_transaction_state[:level] < 1 || force
restore_state = remove_instance_variable(:@_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)