Skip to content

Commit 2dab082

Browse files
fcheunglifo
authored andcommitted
Don't use the transaction instance method so that people with has_one/belongs_to :transaction aren't fubared
[rails#1551 state:committed] Signed-off-by: Jeremy Kemper <[email protected]>
1 parent 5f95347 commit 2dab082

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

activerecord/lib/active_record/transactions.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ def save_with_transactions(perform_validation = true) #:nodoc:
147147
end
148148

149149
def save_with_transactions! #:nodoc:
150-
rollback_active_record_state! { transaction { save_without_transactions! } }
150+
rollback_active_record_state! { self.class.transaction { save_without_transactions! } }
151151
end
152152

153153
# Reset id and @new_record if the transaction rolls back.
@@ -175,7 +175,7 @@ def rollback_active_record_state!
175175
# instance.
176176
def with_transaction_returning_status(method, *args)
177177
status = nil
178-
transaction do
178+
self.class.transaction do
179179
status = send(method, *args)
180180
raise ActiveRecord::Rollback unless status
181181
end

0 commit comments

Comments
 (0)