diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-05-22 12:15:06 -0700 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-05-22 12:15:06 -0700 |
commit | 9ee85281bca899fc521200a087149d7c8c3940d9 (patch) | |
tree | 8f9f727fc2ffd24c9cd46e858343f5bed6b9d16c /activerecord/lib | |
parent | 56b86a377a9fa7d63a6fce1e5801c4910dfc703e (diff) | |
parent | a5430024fd7e654d379b20373247033f68ec0a21 (diff) | |
download | rails-9ee85281bca899fc521200a087149d7c8c3940d9.tar.gz rails-9ee85281bca899fc521200a087149d7c8c3940d9.tar.bz2 rails-9ee85281bca899fc521200a087149d7c8c3940d9.zip |
Merge pull request #6445 from chancancode/3-2-stable_restore_frozen_state_on_rollback
Restore the frozen state on rollback. (Backports #6420)
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 2c70d31b94..8c93f50926 100644 --- a/activerecord/lib/active_record/transactions.rb +++ b/activerecord/lib/active_record/transactions.rb @@ -327,7 +327,8 @@ module ActiveRecord @_start_transaction_state[:level] = (@_start_transaction_state[:level] || 0) - 1 if @_start_transaction_state[:level] < 1 restore_state = remove_instance_variable(:@_start_transaction_state) - @attributes = @attributes.dup if @attributes.frozen? + was_frozen = @attributes.frozen? + @attributes = @attributes.dup if was_frozen @new_record = restore_state[:new_record] @destroyed = restore_state[:destroyed] if restore_state.has_key?(:id) @@ -336,6 +337,7 @@ module ActiveRecord @attributes.delete(self.class.primary_key) @attributes_cache.delete(self.class.primary_key) end + @attributes.freeze if was_frozen end end end |