Transactions

Ok, how does everyone else do transactions in development mode? If I get a exception within a transaction, I get the ruby exception screen, I want rails to complete the block code, and then rollback the transaction. Is there a way to disable the exception screen before the transaction, and then enable it after the transaction?

Thanks!

Hmm, sounds odd that you’d want to continue executing the block. What exactly are you doing, there may be another way about it.

If you can’t change your design, you could try something like this:

def do_extra

end

begin

MyModel.transaction do

obj.bork("lala") # Raise
do_extra

end

ensure

do_extra

end

You’d probably need various versions of extra functions depending on where the exception is raised in block. I recommend trying to refactor your code if possible.

Thanks for the help, that seemed to do the trick.