<?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>Don&#039;t Forget to Plant It! &#187; fixtures</title>
	<atom:link href="http://blog.codeeg.com/tag/fixtures/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.codeeg.com</link>
	<description></description>
	<lastBuildDate>Wed, 28 Jul 2010 12:22:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Problems With Rails Fixture Labels?</title>
		<link>http://blog.codeeg.com/2008/07/13/problems-with-rails-fixture-labels/</link>
		<comments>http://blog.codeeg.com/2008/07/13/problems-with-rails-fixture-labels/#comments</comments>
		<pubDate>Sun, 13 Jul 2008 20:33:37 +0000</pubDate>
		<dc:creator>Calvin</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[fixtures]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://dontforgettoplantit.wordpress.com/?p=149</guid>
		<description><![CDATA[Newer versions of Rails has a nice feature where you can use label references for fixtures. So instead of: # posts.yml test_post: user_id: 1 title: My Test Post You can do this: test_post: user: quentin title: My Test Post However, if your model class name is in a pluralized form, you might find that label [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Newer versions of Rails has a nice feature where you can use label references for fixtures.  So instead of:</p>
<pre><code># posts.yml
test_post:
  user_id: 1
  title: My Test Post
</code></pre>
<p>You can do this:</p>
<pre><code>test_post:
  user: quentin
  title: My Test Post
</code></pre>
<p>However, if your model class name is in a pluralized form, you might find that label references won&#8217;t work.  That&#8217;s because fixtures derive their class name from the singular form of the table name by default.  Fortunately, you can fix this by adding this line to your TestHelper:</p>
<pre><code>class Test::Unit::TestCase

  # Explicitly map the table name to class name
  set_fixture_class :accounts =&gt; 'accounts'
end
</code></pre>
<p>Hopefully, this will save someone else from having to dig through the Rails fixtures internals.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.codeeg.com/2008/07/13/problems-with-rails-fixture-labels/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
