diff options
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/CHANGELOG | 2 | ||||
-rw-r--r-- | activerecord/lib/active_record/transactions.rb | 8 |
2 files changed, 7 insertions, 3 deletions
diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG index 4a3be8bee4..7a71eb3ac9 100644 --- a/activerecord/CHANGELOG +++ b/activerecord/CHANGELOG @@ -1,6 +1,6 @@ *SVN* -* Don't rollback in teardown unless a transaction was started. Don't start a transaction in create_fixtures if a transaction is started. #6282 [lukfugl, Jeremy Kemper] +* Don't rollback in teardown unless a transaction was started. Don't start a transaction in create_fixtures if a transaction is started. #6282 [Jacob Fugal, Jeremy Kemper] * Add #delete support to has_many :through associations. Closes #6049 [Martin Landers] diff --git a/activerecord/lib/active_record/transactions.rb b/activerecord/lib/active_record/transactions.rb index 5e82fd2d8e..84da1e91d6 100644 --- a/activerecord/lib/active_record/transactions.rb +++ b/activerecord/lib/active_record/transactions.rb @@ -11,7 +11,7 @@ module ActiveRecord base.extend(ClassMethods) base.class_eval do - [:destroy, :save].each do |method| + [:destroy, :save, :save!].each do |method| alias_method_chain method, :transactions end end @@ -115,9 +115,13 @@ module ActiveRecord def destroy_with_transactions #:nodoc: transaction { destroy_without_transactions } end - + def save_with_transactions(perform_validation = true) #:nodoc: transaction { save_without_transactions(perform_validation) } end + + def save_with_transactions! #:nodoc: + transaction { save_without_transactions! } + end end end |