You could just wrap the code in your method in a transaction block. As
the docs say:
+transaction+ calls can be nested. By default, this makes all database
statements in the nested transaction block become part of the parent
transaction.
I.e., a nested transaction block does *not* result in a nested
transaction. If you want the latter, you have to use
transaction(:requires_new => true).