<?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"
	>
<channel>
	<title>Comments on: Basic CRUD for Nested Elements using RESTful Rails</title>
	<atom:link href="http://solutions.treypiepmeier.com/2006/11/05/basic-crud-for-nested-elements-using-restful-rails/feed/" rel="self" type="application/rss+xml" />
	<link>http://solutions.treypiepmeier.com/2006/11/05/basic-crud-for-nested-elements-using-restful-rails/</link>
	<description>So I don't have to figure things out more than once.</description>
	<pubDate>Thu, 28 Aug 2008 10:01:51 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.1</generator>
		<item>
		<title>By: Ltmon</title>
		<link>http://solutions.treypiepmeier.com/2006/11/05/basic-crud-for-nested-elements-using-restful-rails/#comment-3958</link>
		<dc:creator>Ltmon</dc:creator>
		<pubDate>Wed, 20 Jun 2007 01:55:01 +0000</pubDate>
		<guid isPermaLink="false">http://solutions.treypiepmeier.com/2006/11/05/basic-crud-for-nested-elements-using-restful-rails/#comment-3958</guid>
		<description>&lt;p&gt;Instead of:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;@appliance = appliance.new(params[:appliance])
@appliance.manufacturer_id = params[:manufacturer_id]
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;I would do:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;@appliance = @manufacturer.appliances.build(params[:appliance])
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;It's a little method thrown into ActiveRecord for just this purpose.  Similarly when you are doing you "edit" and "show" methods you can do:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;@appliance = @manufacturer.appliances.find(params[:id])
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This ensures that the appliance you are retrieving actually belongs to the parent manufacturer.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Instead of:</p>

<pre><code>@appliance = appliance.new(params[:appliance])
@appliance.manufacturer_id = params[:manufacturer_id]
</code></pre>

<p>I would do:</p>

<pre><code>@appliance = @manufacturer.appliances.build(params[:appliance])
</code></pre>

<p>It&#8217;s a little method thrown into ActiveRecord for just this purpose.  Similarly when you are doing you &#8220;edit&#8221; and &#8220;show&#8221; methods you can do:</p>

<pre><code>@appliance = @manufacturer.appliances.find(params[:id])
</code></pre>

<p>This ensures that the appliance you are retrieving actually belongs to the parent manufacturer.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Solutions Log &#187; Blog Archive &#187; Basic CRUD using REST in Rails</title>
		<link>http://solutions.treypiepmeier.com/2006/11/05/basic-crud-for-nested-elements-using-restful-rails/#comment-28</link>
		<dc:creator>Solutions Log &#187; Blog Archive &#187; Basic CRUD using REST in Rails</dc:creator>
		<pubDate>Sun, 05 Nov 2006 09:04:46 +0000</pubDate>
		<guid isPermaLink="false">http://solutions.treypiepmeier.com/2006/11/05/basic-crud-for-nested-elements-using-restful-rails/#comment-28</guid>
		<description>&lt;p&gt;[...] Continued here&#8230; [...]&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>[...] Continued here&#8230; [...]</p>]]></content:encoded>
	</item>
</channel>
</rss>
