Ideally, you'd want something like this:

   def within_new_transaction(options = {}) #:nodoc:
     begin_transaction(options)

     begin
       result = yield
       commit_transaction
     rescue
       rollback_transaction
       raise
     end

     result
   end

Unfortunately, this does not handle the case where the user calls `return`
inside the block that is yielded to this method. In that case, Ruby would
immediately unwind the stack and skip the rest of the method. The only way to
handle this situation is to use an `ensure` block. This resulted in the awkward
flow-control code that is really difficult to understand.

This is a best way I could think of to improve it a little bit way still
handling the explicit return scenario.