This project is archived and is in readonly mode.

#891 ✓committed
Xavier Noria

let cancels from before filters issue a ROLLBACK

Reported by Xavier Noria | August 24th, 2008 @ 02:26 AM | in 2.x

The AR methods save, save!, and destroy run within a transaction that wraps their entire callback chain.

Before filters may cancel the action returning false. Currently that triggers a ROLLBACK only in the case of save!. With this patch a ROLLBACK is issued as well for save and destroy, preserving their regular usage idioms.

The patch is backwards compatible in the sense that if someone raised exceptions to trigger ROLLBACKs that still works.

It breaks applications that expect COMMITs when canceling save or destroy calls. But I think those are going to be rare, and I believe this change is worth that price anyway.

Some documentation has been written as well. That goes into callbacks.rb because feels like the natural spot from the point of view of the user. It doesn't matter the implementation is split in different files.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Attachments

Referenced by

Pages