<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Using transactions with Ruby DataMapper</title>
	<atom:link href="http://blog.kabisa.nl/2010/01/21/using-transactions-with-ruby-datamapper/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.kabisa.nl/2010/01/21/using-transactions-with-ruby-datamapper/</link>
	<description>The Ruby on Rails Experts</description>
	<lastBuildDate>Sat, 03 Jul 2010 14:41:50 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Ariejan</title>
		<link>http://blog.kabisa.nl/2010/01/21/using-transactions-with-ruby-datamapper/comment-page-1/#comment-43</link>
		<dc:creator>Ariejan</dc:creator>
		<pubDate>Fri, 22 Jan 2010 08:05:43 +0000</pubDate>
		<guid isPermaLink="false">http://blog.kabisa.nl/?p=52#comment-43</guid>
		<description>To mimic AR&#039;s behaviour, you could do the following

&lt;pre lang=&quot;ruby&quot;&gt;User.transaction do &#124;t&#124;
  begin
    User.first.update(:name =&gt; &quot;John Smith&quot;)
    Address.first.update(:street =&gt; &quot;Oak St. 400&quot;)
  rescue
    t.rollback
  end
end&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>To mimic AR&#8217;s behaviour, you could do the following</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">User.<span style="color:#9900CC;">transaction</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>t<span style="color:#006600; font-weight:bold;">|</span>
  <span style="color:#9966CC; font-weight:bold;">begin</span>
    User.<span style="color:#9900CC;">first</span>.<span style="color:#9900CC;">update</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;John Smith&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    Address.<span style="color:#9900CC;">first</span>.<span style="color:#9900CC;">update</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:street</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;Oak St. 400&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">rescue</span>
    t.<span style="color:#9900CC;">rollback</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

]]></content:encoded>
	</item>
</channel>
</rss>
