Please sign in to comment.
Ensure transactions around save and destroy are rolled back when a be…
…fore hook returns false Three cases: 1) raise_on_save_failure true: Existing behavior was correct; save_failure raises an exception that rolls back the transaction and is reraised. 2) raise_on_save_failure false and use_transaction true: save_failure raises Rollback, which the transaction code will take care of. 3) raise_on_save_failure false and use_transaction false: should just return false, as raising Rollback and catching it makes it impossible to differentiate between the a before hook returning false and a user raising Rollback in a before hook (which they expect to bubble up to their own transaction code). While here, support the :transaction option in destroy
- Loading branch information...
Showing with 96 additions and 12 deletions.