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

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Bb4bdf2b184027bc38d4fb529770cde5?d=identicon&s=25 Wes Gamble (weyus)
on 2007-01-19 18:54
All,

I think I'm seeing the behavior specified in this post to Rails-core:
http://www.ruby-forum.com/topic/81605

I believe that this post is an example of the behavior I'll describe as
well:
http://www.ruby-forum.com/topic/83260

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.

Thanks,
Wes
This topic is locked and can not be replied to.