Transactions

June 26, 2009

Runy on Rails has a cool support for database transactions. Basically, if you need to save 2 objects as a result of a particular action, you need to make sure that the 2nd is saved only if the first is saved successfully:

balance.transaction do
    balance.save!
    account.save!
end

More information here.

Entry Filed under: Uncategorized. .

Leave a Comment

Required

Required, hidden

Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Trackback this post  |  Subscribe to the comments via RSS Feed


Recent posts

Starting to learn Rails?

Archive

Recent comments

allaboutruby on Post ruby or html, css, sql so…
Wolf on Post ruby or html, css, sql so…
allaboutruby on Google Maps API in Rails (YM4R…
Christian on Google Maps API in Rails (YM4R…
Pankaj Sisodiya on Installing Rails on Windows (3…