<?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: Developing RESTful APIs in Rails</title>
	<atom:link href="http://techblog.floorplanner.com/2008/05/22/developing-restful-apis-in-rails/feed/" rel="self" type="application/rss+xml" />
	<link>http://techblog.floorplanner.com/2008/05/22/developing-restful-apis-in-rails/</link>
	<description>Our latest geek adventures!</description>
	<lastBuildDate>Tue, 16 Mar 2010 19:42:56 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Chris</title>
		<link>http://techblog.floorplanner.com/2008/05/22/developing-restful-apis-in-rails/comment-page-1/#comment-623</link>
		<dc:creator>Chris</dc:creator>
		<pubDate>Fri, 29 May 2009 19:39:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.suite75.net/blog/dev/developing-restful-apis-in-rails.html#comment-623</guid>
		<description>Thanks for the explanation and solution... my to_xml calls were getting ugly so I did the exact same thing: made the options hash a constant..</description>
		<content:encoded><![CDATA[<p>Thanks for the explanation and solution&#8230; my to_xml calls were getting ugly so I did the exact same thing: made the options hash a constant..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Willem</title>
		<link>http://techblog.floorplanner.com/2008/05/22/developing-restful-apis-in-rails/comment-page-1/#comment-88</link>
		<dc:creator>Willem</dc:creator>
		<pubDate>Wed, 06 Aug 2008 14:47:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.suite75.net/blog/dev/developing-restful-apis-in-rails.html#comment-88</guid>
		<description>Jaap solved to mysterious to_xml bug some time ago, and I thought it may be useful to others to post the solution here as well. Hopefully it will save others a lot of debugging, as we have wasted enough time on this &quot;bug&quot;.

It turned out that we provided options to to_xml as a constant (a Hash). A constant can&#039;t be reassigned, but the object that the constant holds &lt;strong&gt;can&lt;/strong&gt; be altered. The implementation of to_xml puts an XML builder object in the options array. In production mode, this constant wasn&#039;t reloaded between requests, so the XML builder object was kept in the constant hash. After discovering, the solution was simple.

Instead of &lt;code&gt;@projects.to_xml(DEFAULT_OPTIONS)&lt;/code&gt;, use &lt;code&gt;@projects.to_xml(DEFAULT_OPTIONS.clone)&lt;/code&gt; so the XML builder object will not be put into the constant but in a clone, which will be disgarded after the to_xml-method completes.</description>
		<content:encoded><![CDATA[<p>Jaap solved to mysterious to_xml bug some time ago, and I thought it may be useful to others to post the solution here as well. Hopefully it will save others a lot of debugging, as we have wasted enough time on this &#8220;bug&#8221;.</p>
<p>It turned out that we provided options to to_xml as a constant (a Hash). A constant can&#8217;t be reassigned, but the object that the constant holds <strong>can</strong> be altered. The implementation of to_xml puts an XML builder object in the options array. In production mode, this constant wasn&#8217;t reloaded between requests, so the XML builder object was kept in the constant hash. After discovering, the solution was simple.</p>
<p>Instead of <code>@projects.to_xml(DEFAULT_OPTIONS)</code>, use <code>@projects.to_xml(DEFAULT_OPTIONS.clone)</code> so the XML builder object will not be put into the constant but in a clone, which will be disgarded after the to_xml-method completes.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
