Re: Database Transactions
- From: "Robert Klemme" <bob.news@xxxxxxx>
- Date: Tue, 15 Nov 2005 13:00:57 +0100
Andreas Schwarz wrote:
> listrecv wrote:
>> ActiveRecord's standard procedure for transactions is to send a
>> block, and throw an exception to roll it back (
>>
http://api.rubyonrails.com/classes/ActiveRecord/Transactions/ClassMethods.html
>> ). I found this rather uncomfortable. I'd like to be able to begin
>> transactions, commit them, or roll them back from within (fairly)
>> complex control structures - and having to do everything within a
>> block, with one way out, is no good.
>
> You can start/commit/rollback transactions manually
> (ActiveRecord::Base.connection.start_transaction, IIRC). Though I
> don't see why using a block should be a problem for your control
> structure.
+1
Using the block is definitely superior and less error prone. Hint: you
can call methods from the block. :-)
Kind regards
robert
.
- References:
- Database Transactions
- From: listrecv
- Re: Database Transactions
- From: Andreas Schwarz
- Database Transactions
- Prev by Date: Re: Parameter names from reflection?
- Next by Date: Re: Converting between Time and DateTime
- Previous by thread: Re: Database Transactions
- Next by thread: Re: Database Transactions
- Index(es):
Relevant Pages
|