diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2006-10-10 19:34:25 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2006-10-10 19:34:25 +0000 |
commit | 629b8af2b0e143b18aa4206beb6006b9f9898788 (patch) | |
tree | ab377596a788ef10aa87fe0a6e2f6b0a991bd05c /activerecord/lib | |
parent | 5e08c668d264ada2c9f1f4eb354da9aa27f4c279 (diff) | |
download | rails-629b8af2b0e143b18aa4206beb6006b9f9898788.tar.gz rails-629b8af2b0e143b18aa4206beb6006b9f9898788.tar.bz2 rails-629b8af2b0e143b18aa4206beb6006b9f9898788.zip |
Wrap save! in a transaction. Closes #6324.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5281 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
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 |