diff options
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/transactions.rb | 8 |
1 files changed, 6 insertions, 2 deletions
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 |