diff options
author | Brian Durand <brian@embellishedvisions.com> | 2010-06-18 16:59:33 -0500 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2010-06-18 15:11:17 -0700 |
commit | 237165feb3e5f7b117b05353bd64d756b9f18f74 (patch) | |
tree | f2da9c8c97555e849fe2978fb4a35e99f5b17513 /activerecord/lib | |
parent | a186431414de8a0f0db9f60254f421a3536cee12 (diff) | |
download | rails-237165feb3e5f7b117b05353bd64d756b9f18f74.tar.gz rails-237165feb3e5f7b117b05353bd64d756b9f18f74.tar.bz2 rails-237165feb3e5f7b117b05353bd64d756b9f18f74.zip |
Fix bug with rolling back frozen attributes.
[#2991]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb | 4 | ||||
-rw-r--r-- | activerecord/lib/active_record/transactions.rb | 1 |
2 files changed, 3 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb b/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb index b9fb452eee..25432e9985 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb @@ -304,7 +304,7 @@ module ActiveRecord begin record.rolledback!(rollback) rescue Exception => e - record.logger.error(e) if record.respond_to?(:logger) + record.logger.error(e) if record.respond_to?(:logger) && record.logger end end end @@ -319,7 +319,7 @@ module ActiveRecord begin record.committed! rescue Exception => e - record.logger.error(e) if record.respond_to?(:logger) + record.logger.error(e) if record.respond_to?(:logger) && record.logger end end end diff --git a/activerecord/lib/active_record/transactions.rb b/activerecord/lib/active_record/transactions.rb index 620758f5af..775d9f0fb8 100644 --- a/activerecord/lib/active_record/transactions.rb +++ b/activerecord/lib/active_record/transactions.rb @@ -320,6 +320,7 @@ module ActiveRecord if @_start_transaction_state[:level] < 1 restore_state = remove_instance_variable(:@_start_transaction_state) if restore_state + @attributes = @attributes.dup if @attributes.frozen? @new_record = restore_state[:new_record] @destroyed = restore_state[:destroyed] if restore_state[:id] |