First page Back Continue Last page Overview Text


(3 secs) The solution to this is fairly simple.

You just need to make sure that all code that must be executed is inside an ensure block.

I think the original author of this code didn't want the commit query to be sent in case of an error, which is why it wasn't in the ensure block to begin with.

If you only want code to be executed if no exception was raised, you should have the rescue block assign the exception to a local variable, and then inside the ensure block, only execute the code if that variable is nil.