> I think it's this slight confusion that worries me.... if it could
> have two possible interpretations, then I would hope that the less
> dangerous one would be implemented?
>
> I'd certainly prefer to find out that the reason my model wasn't being
> destroyed was that I can't COMMIT a transaction with a 'return', than
> to discover that my data is going missing because I was using break to
> drop outs of a transaction early?

It's way too risky for rails to try and guess what your intentions
are.  That way lies madness

You can do this at present by raising an exception to roll back the
transaction,  but you then have to rescue it

so at present you have to do

begin
 transaction do
  @item.save
  raise SomethingError.new
 end
rescue SomethingError=>se
end

if we could simplify that to

transaction do
  @item.save
  raise ActiveRecord::RollbackTransaction.new
end

Life would be much easier for all concerned

Alternatively in edge you can currently rollback the transaction explicitly.

http://dev.rubyonrails.org/changeset/6196

That API isn't necessarily the final one, but it would certainly be
nice to have an exception you can raise to roll back the transaction
without necessarily having to rescue it explicitly.


-- 
Cheers

Koz

--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
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