AR Transactions w/ multiple models - reality check?

Hello,

As Dave demonstrates in AWDR, p242 “Transactions”,
User.transaction(user) do
Account.transaction(account) do
account.save #success
user.save #failure
end
end

Unlike his example, my User and Account are actually on teh same
database…
in my example, does the failure of user.save reverse the transaction?

Thanks,

Something like that. I know I switched to .save! (it throws an
exception when it fails, instead of just returning “false”), and it may
be that I had to do that to get nested transactions like this to work
right. (Right being defined as that neither table is changed if either
one fails.)

Hope that helps,
Asa

Do you mean “save!”? “save” doesn’t result in an exception as far as I
know but “save!” does.

If you have just one database, do you really need User.transaction and
Account.transaction? Wouldn’t it suffice with just one?

(I know just about nothing about Rails’ transaction support)

/Jonas