diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-08-11 19:08:16 -0700 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-08-11 23:24:47 -0300 |
commit | 786713a3abc375fab4d5c2f6f62a878c2ab51022 (patch) | |
tree | 70035fe7fa1d94d9e3e92726533e9a34c2570959 /activerecord/lib/active_record | |
parent | 20f18cbc148270112c670189cf5489900a2271dc (diff) | |
download | rails-786713a3abc375fab4d5c2f6f62a878c2ab51022.tar.gz rails-786713a3abc375fab4d5c2f6f62a878c2ab51022.tar.bz2 rails-786713a3abc375fab4d5c2f6f62a878c2ab51022.zip |
Merge pull request #6073 from daveyeu/restore-state-on-record-invalid
Restore state on create when ActiveRecord::RecordInvalid is raised
Conflicts:
activerecord/CHANGELOG.md
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/transactions.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/transactions.rb b/activerecord/lib/active_record/transactions.rb index 8c93f50926..98569aa307 100644 --- a/activerecord/lib/active_record/transactions.rb +++ b/activerecord/lib/active_record/transactions.rb @@ -325,7 +325,7 @@ module ActiveRecord def restore_transaction_record_state(force = false) #:nodoc: if defined?(@_start_transaction_state) @_start_transaction_state[:level] = (@_start_transaction_state[:level] || 0) - 1 - if @_start_transaction_state[:level] < 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 |