<?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: Using AR::Associations to limit find() scope</title>
	<atom:link href="http://www.sitepoint.com/blogs/2006/07/02/using-arassociations-to-limit-find-scope/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sitepoint.com/blogs/2006/07/02/using-arassociations-to-limit-find-scope/</link>
	<description>News, opinion, and fresh thinking for web developers and designers. The official podcast of sitepoint.com.</description>
	<pubDate>Thu, 04 Dec 2008 03:34:34 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5</generator>
		<item>
		<title>By: timlucas</title>
		<link>http://www.sitepoint.com/blogs/2006/07/02/using-arassociations-to-limit-find-scope/#comment-34703</link>
		<dc:creator>timlucas</dc:creator>
		<pubDate>Mon, 03 Jul 2006 03:36:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=1610#comment-34703</guid>
		<description>Stevenwulf: Nope, the find is only for database fetches. If you were storing it in memory (in the session for example) then you'd probably be referencing it by position in the line_items array, rather than the record's id.

For this app I'm creating the order in the database with a state of 'unfinished'. I store the session id with the order, so when I delete old sessions from the database I also delete their unfinished orders.</description>
		<content:encoded><![CDATA[<p>Stevenwulf: Nope, the find is only for database fetches. If you were storing it in memory (in the session for example) then you&#8217;d probably be referencing it by position in the line_items array, rather than the record&#8217;s id.</p>
<p>For this app I&#8217;m creating the order in the database with a state of &#8216;unfinished&#8217;. I store the session id with the order, so when I delete old sessions from the database I also delete their unfinished orders.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Stevenwulf</title>
		<link>http://www.sitepoint.com/blogs/2006/07/02/using-arassociations-to-limit-find-scope/#comment-34701</link>
		<dc:creator>Stevenwulf</dc:creator>
		<pubDate>Mon, 03 Jul 2006 03:20:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=1610#comment-34701</guid>
		<description>What if the order's lineitem hasn't been saved and is only in memory.  will the find still work?</description>
		<content:encoded><![CDATA[<p>What if the order&#8217;s lineitem hasn&#8217;t been saved and is only in memory.  will the find still work?</p>]]></content:encoded>
	</item>
	<item>
		<title>By: timlucas</title>
		<link>http://www.sitepoint.com/blogs/2006/07/02/using-arassociations-to-limit-find-scope/#comment-34686</link>
		<dc:creator>timlucas</dc:creator>
		<pubDate>Mon, 03 Jul 2006 02:32:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=1610#comment-34686</guid>
		<description>I forgot to mention there's also the &lt;a href="http://www.agilewebdevelopment.com/plugins/scoped_access" rel="nofollow"&gt;ScopedAccess&lt;/a&gt; and &lt;a href="http://roman2k.free.fr/rails/meantime_filter/0.1.0/rdoc/" rel="nofollow"&gt;MeantimeFilter&lt;/a&gt; plugins which help limiting the scope of database fetches. Only problem with using plugins though is you're not guaranteed they won't break on future versions of Rails, and the technique I described is useful elsewhere.</description>
		<content:encoded><![CDATA[<p>I forgot to mention there&#8217;s also the <a href="http://www.agilewebdevelopment.com/plugins/scoped_access" rel="nofollow">ScopedAccess</a> and <a href="http://roman2k.free.fr/rails/meantime_filter/0.1.0/rdoc/" rel="nofollow">MeantimeFilter</a> plugins which help limiting the scope of database fetches. Only problem with using plugins though is you&#8217;re not guaranteed they won&#8217;t break on future versions of Rails, and the technique I described is useful elsewhere.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: timlucas</title>
		<link>http://www.sitepoint.com/blogs/2006/07/02/using-arassociations-to-limit-find-scope/#comment-34672</link>
		<dc:creator>timlucas</dc:creator>
		<pubDate>Mon, 03 Jul 2006 00:17:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=1610#comment-34672</guid>
		<description>See my note in the last paragraph ;)

An example of using the verify macro:
&lt;pre&gt;&lt;code class="ruby"&gt;
class LineItemsController &#60; ActionController::Base
  verify :method =&#62; :post, :only =&#62; :destroy
  def destroy
    ..
  end
end
&lt;/code&gt;&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>See my note in the last paragraph ;)</p>
<p>An example of using the verify macro:</p>
<pre><code class="ruby">
class LineItemsController &lt; ActionController::Base
  verify :method =&gt; :post, :only =&gt; :destroy
  def destroy
    ..
  end
end
</code></pre>]]></content:encoded>
	</item>
	<item>
		<title>By: wwb_99</title>
		<link>http://www.sitepoint.com/blogs/2006/07/02/using-arassociations-to-limit-find-scope/#comment-34583</link>
		<dc:creator>wwb_99</dc:creator>
		<pubDate>Sun, 02 Jul 2006 13:38:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=1610#comment-34583</guid>
		<description>Very good point. Any user input should always be sanity checked.

I would, however, note that one should not be taking actions other than retrieving information using Http GET requests. That should be completely handled using POST. The main reason for this is things like bots can have an interesting effect on things. There was a situation once where google started deleting people's profile because the delete command was something like "userprofile.php?id=NN&#38;action=delete"</description>
		<content:encoded><![CDATA[<p>Very good point. Any user input should always be sanity checked.</p>
<p>I would, however, note that one should not be taking actions other than retrieving information using Http GET requests. That should be completely handled using POST. The main reason for this is things like bots can have an interesting effect on things. There was a situation once where google started deleting people&#8217;s profile because the delete command was something like &#8220;userprofile.php?id=NN&amp;action=delete&#8221;</p>]]></content:encoded>
	</item>
</channel>
</rss>
