<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Postpostmodern &#187; ActiveRecord</title>
	<atom:link href="http://postpostmodern.com/tag/activerecord/feed/" rel="self" type="application/rss+xml" />
	<link>http://postpostmodern.com</link>
	<description>Speaking of web development.</description>
	<lastBuildDate>Wed, 11 Jan 2012 00:21:50 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Rails Tip: Default Scope</title>
		<link>http://postpostmodern.com/instructional/rails-tip-default-scope/</link>
		<comments>http://postpostmodern.com/instructional/rails-tip-default-scope/#comments</comments>
		<pubDate>Tue, 04 Nov 2008 16:27:30 +0000</pubDate>
		<dc:creator>Jason Johnson</dc:creator>
				<category><![CDATA[Instructional]]></category>
		<category><![CDATA[ActiveRecord]]></category>
		<category><![CDATA[named_scope]]></category>
		<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://postpostmodern.com/?p=221</guid>
		<description><![CDATA[An easy way to designate default options for find(:all)]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve started using the <a href="http://www.railsbrain.com/api/rails-2.1.2/doc/index.html?a=M003687&#038;name=all"><strong>all</strong></a> method instead of <strong>find(:all)</strong> for fetching records – mainly because it&#8217;s shorter to type, but it&#8217;s also easy to override with a named scope. Just create a named_scope called <strong>all</strong> to set whatever default conditions and order you want. You can always use <strong>find(:all)</strong> if you want the non-scoped records.</p>

<pre><code lang="ruby">named_scope :all, { 
  :order => 'last_name',
  :conditions => 'activated_at IS NOT NULL'
}</code></pre>

<p>Thoughts, corrections and objections welcome in the comments.</p>
]]></content:encoded>
			<wfw:commentRss>http://postpostmodern.com/instructional/rails-tip-default-scope/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

