What I'm trying to do is to make sure certain models are only ever saved inside a transaction.
So I wat to write a macro method such that I can do:
class Foo < ActiveRecrod::Base
require_transaction
end
And it will throw an exception if in before_save it detects that there's no transaction going. i.e.
@foo.save! # should fail
AnyOtherModelOrFoo.transaction do
@foo.save! # should work
end
Next stage will be detecting if the model is locked. i.e. if it was selected with :lock => true. But this is step 2 :-)