Transactions

June 26, 2009 at 1:12 pm Leave a comment

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.

Advertisements

Entry filed under: Uncategorized.

Installing Mongrel Acts_as_versioned tutorial

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Trackback this post  |  Subscribe to the comments via RSS Feed


Recent posts

Starting to learn Rails?

Kindle

Get Kindle - the best e-book reader, that I personally use, and the only one that you can read on the beach - very useful: Kindle Wireless Reading Device (6" Display, Global Wireless, Latest Generation)

%d bloggers like this: