Rails transaction: does it matter on which ActiveRecord model class?

Viewed 1466

When I have 2 objects to save inside a transaction

a = A.new(...)  
b = B.new(...)

Does it matter on which model class I invoke the transaction method?

A.transaction do
  a.save
  b.save
end

or

B.transaction do
  a.save
  b.save
end

IMNO both use the same db transaction, because ActiveRecord can only handle one connection, thus it should not matter. Is that correct?

Thanks, Alex.

2 Answers
Related