On Jun 2, 2004, at 9:34 AM, Carl Youngblood wrote:
> David Heinemeier Hansson wrote:
>> Be aware, though, that the objects will not have their instance data  
>> returned to their state before the transaction started. YouÁÍl have 
>> to  deal with that yourself (just as in the case of Validations). 
>> Also have  in mind that exceptions thrown within a transaction block 
>> will be  propagated (after triggering the ROLLBACK), so you should be 
>> ready to  catch those in your application code.
>
> Is this for performance reasons?  It seems like it wouldn't be too 
> hard to undo the changes to instance data if an exception were thrown.

I could actually see an usefulness to the current 
(non-instance-rollback) mechanism:

If the transaction fails, your code can look at various instances and 
see which ones worked (the instance is the same as what you attempted 
to set it to) and thus at which point exactly it failed (the instance 
never got set).

But that's not something I've needed to do, just making up a use case 
to fit the feature. :) And possibly the same information can be 
determined from the exception.


I love Active Record, and I have even started using it yet :)