Though the transaction class method is called on some ActiveRecord class, the objects within the transaction block need not all be instances of that class. This is because transactions are per-database connection, not per-model.
In this example a balance record is transactionally saved even though transaction is called on the Account class:
Account.transaction do
balance.save!
account.save!
end
The transaction method is also available as a model instance method. For example, you can also do this:
balance.transaction do
balance.save!
account.save!
end