Forum: Ruby on Rails Transactions

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.
D50c89ef4998bde03fa31be2169c0b65?d=identicon&s=25 rjprado (Guest)
on 2007-07-02 22:05
(Received via mailing list)
Hi all,

Suppose I have a transaction nested within a loop. Like the folowing:

4.times do
  Product.transaction do
    # do something
    next if flag
    # do something else
  end
end

Would the transaction be rolled back if the "next" statement is
reached?

Thanks,
Roberto Prado.
Bce1d1b7c3ec7b577dcb42e254899e6b?d=identicon&s=25 Michael Schuerig (Guest)
on 2007-07-03 01:45
(Received via mailing list)
On Monday 02 July 2007, rjprado wrote:

> Would the transaction be rolled back if the "next" statement is
No, the transaction is *only* rolled back, if the transaction block is
exited by an exception.

Michael

--
Michael Schuerig
mailto:michael@schuerig.de
http://www.schuerig.de/michael/
This topic is locked and can not be replied to.