Im not able to reproduce your first example:

> ActiveRecord::Base.connection.transaction do
>  Model.create!
>  raise
> end
> # in this case the Model creation is NOT rolled back

I can't remember ever running into a situation where that would get
committed.  Even if a new transaction isn't opened for that block
because one was already open, the exception still raises to the outer
transaction which should cause the rollback.  Maybe I'm wrong.

But anyway, I have attempted to simplify working with transactions
myself.  I started with this:

http://code.stat.im/repos/plugins/super_transaction/trunk/lib/super_transaction.rb
(I recommend against using it/dont use it)

But I thought it was overkill and ended up running into some issues
with it.  Im now using this code (haven't pluginized it yet):

http://pastie.caboo.se/101202

Its very straight forward and doesn't hack anything up in core.  The
basic idea is to simplify exception handling so it doesn't need to be
duplicated everywhere throughout the application.  It also allows for
calling #save instead of #save! if you dont want to die on the first
failure (validation errors get populated on all attempted #save's).

I think you've got some cool stuff there and are addressing some
different issues than I am, but the first example you gave did get me
worried.  Either way I agree transactions and exception handling in
transactions could definitely be improved.

Joe


On Sep 26, 2:32 pm, -a <[EMAIL PROTECTED]> wrote:
> summary:
>
>  http://drawohara.tumblr.com/post/12411960
>
> i am the only one thinking along these terms?
>
> is there some rationale i'm missing behind the current behaviour?
>
> kind regards.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to rubyonrails-core@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to