Forum: Ruby on Rails AR transaction method doesn't rollback in all cases

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Wes G. (Guest)
on 2007-01-19 19:54

I think I'm seeing the behavior specified in this post to Rails-core:

I believe that this post is an example of the behavior I'll describe as

I'd like to verify the following assertion:

Assertion: Within a transaction block, a rollback will not occur
automatically unless an exception is thrown from within that top-level
block explicitly.  If there are begin/rescue blocks within the
transaction block that catch exceptions, then the transaction block will
not be able to detect these exceptions and will not rollback.

I'm seeing this on a multi-object update, so I am now using save
(instead of save!) and rollback_db_transaction explicitly by detecting
whether each object's error array is non-empty.

This topic is locked and can not be replied to.