<?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: Factory Girl and has_many / has_many :through associations</title>
	<atom:link href="http://danteregis.com/2008/11/factory-girl-and-has_many-has_many-through-associations/feed/" rel="self" type="application/rss+xml" />
	<link>http://danteregis.com/2008/11/factory-girl-and-has_many-has_many-through-associations/</link>
	<description>talking about programming and computer stuff</description>
	<lastBuildDate>Fri, 09 Apr 2010 11:40:09 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: FactoryGirl has_many associations &#171; justsoftwareconsulting.com</title>
		<link>http://danteregis.com/2008/11/factory-girl-and-has_many-has_many-through-associations/comment-page-1/#comment-323</link>
		<dc:creator>FactoryGirl has_many associations &#171; justsoftwareconsulting.com</dc:creator>
		<pubDate>Thu, 15 Oct 2009 19:52:39 +0000</pubDate>
		<guid isPermaLink="false">http://ditoinfo.wordpress.com/?p=85#comment-323</guid>
		<description>[...] a classic example of an unanswered question. Poor Umar wants this very same answer. He gets 3 wrong answers [...]</description>
		<content:encoded><![CDATA[<p>[...] a classic example of an unanswered question. Poor Umar wants this very same answer. He gets 3 wrong answers [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave Rogers</title>
		<link>http://danteregis.com/2008/11/factory-girl-and-has_many-has_many-through-associations/comment-page-1/#comment-99</link>
		<dc:creator>Dave Rogers</dc:creator>
		<pubDate>Sun, 24 May 2009 18:33:51 +0000</pubDate>
		<guid isPermaLink="false">http://ditoinfo.wordpress.com/?p=85#comment-99</guid>
		<description>I had a huge problem creating these associations correctly w/ factory_girl, I finally got it fixed with help, you can check it out here:  http://railsondave.blogspot.com/2009/05/creating-hasmany-through-factories-with.html</description>
		<content:encoded><![CDATA[<p>I had a huge problem creating these associations correctly w/ factory_girl, I finally got it fixed with help, you can check it out here:  <a href="http://railsondave.blogspot.com/2009/05/creating-hasmany-through-factories-with.html" rel="nofollow">http://railsondave.blogspot.com/2009/05/creating-hasmany-through-factories-with.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jay McGavren</title>
		<link>http://danteregis.com/2008/11/factory-girl-and-has_many-has_many-through-associations/comment-page-1/#comment-87</link>
		<dc:creator>Jay McGavren</dc:creator>
		<pubDate>Fri, 24 Apr 2009 22:28:22 +0000</pubDate>
		<guid isPermaLink="false">http://ditoinfo.wordpress.com/?p=85#comment-87</guid>
		<description>Umur,

I was able to associate the child objects properly by ensuring they were written to the database when defining the lazy attribute, like so:

user.groups {&#124;groups&#124; [Factory.create(:group)] }

(.create writes the group to the database and ensures it has an ID, which the association then picks up on.)</description>
		<content:encoded><![CDATA[<p>Umur,</p>
<p>I was able to associate the child objects properly by ensuring they were written to the database when defining the lazy attribute, like so:</p>
<p>user.groups {|groups| [Factory.create(:group)] }</p>
<p>(.create writes the group to the database and ensures it has an ID, which the association then picks up on.)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Umur</title>
		<link>http://danteregis.com/2008/11/factory-girl-and-has_many-has_many-through-associations/comment-page-1/#comment-79</link>
		<dc:creator>Umur</dc:creator>
		<pubDate>Tue, 17 Mar 2009 11:17:24 +0000</pubDate>
		<guid isPermaLink="false">http://ditoinfo.wordpress.com/?p=85#comment-79</guid>
		<description>I simply tried the suggestion making
class User
   has_many :posts
class Post
   belongs_to :user

In the code above all groups end up with “user_id = nil”. Actually the factory creates the posts and the users. And the result is many unrelated posts and users.

Can we consider it a bug or missing feature of factory girl?
The one to many definition does not work:
user.groups {&#124;groups&#124; [groups.association(:group)]}</description>
		<content:encoded><![CDATA[<p>I simply tried the suggestion making<br />
class User<br />
   has_many :posts<br />
class Post<br />
   belongs_to :user</p>
<p>In the code above all groups end up with “user_id = nil”. Actually the factory creates the posts and the users. And the result is many unrelated posts and users.</p>
<p>Can we consider it a bug or missing feature of factory girl?<br />
The one to many definition does not work:<br />
user.groups {|groups| [groups.association(:group)]}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dante regis</title>
		<link>http://danteregis.com/2008/11/factory-girl-and-has_many-has_many-through-associations/comment-page-1/#comment-78</link>
		<dc:creator>dante regis</dc:creator>
		<pubDate>Mon, 16 Mar 2009 23:57:00 +0000</pubDate>
		<guid isPermaLink="false">http://ditoinfo.wordpress.com/?p=85#comment-78</guid>
		<description>I&#039;m sure you couldn&#039;t, and that&#039;s not your fault. It&#039;s not there. I found it on a blog, but since I posted a few days after reading it, I could not remember the source, for what I am sorry.</description>
		<content:encoded><![CDATA[<p>I&#8217;m sure you couldn&#8217;t, and that&#8217;s not your fault. It&#8217;s not there. I found it on a blog, but since I posted a few days after reading it, I could not remember the source, for what I am sorry.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dante regis</title>
		<link>http://danteregis.com/2008/11/factory-girl-and-has_many-has_many-through-associations/comment-page-1/#comment-77</link>
		<dc:creator>dante regis</dc:creator>
		<pubDate>Mon, 16 Mar 2009 23:53:39 +0000</pubDate>
		<guid isPermaLink="false">http://ditoinfo.wordpress.com/?p=85#comment-77</guid>
		<description>can you tell us how your relationships are defined in the models so we can help you better?</description>
		<content:encoded><![CDATA[<p>can you tell us how your relationships are defined in the models so we can help you better?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Umur</title>
		<link>http://danteregis.com/2008/11/factory-girl-and-has_many-has_many-through-associations/comment-page-1/#comment-76</link>
		<dc:creator>Umur</dc:creator>
		<pubDate>Mon, 16 Mar 2009 02:23:37 +0000</pubDate>
		<guid isPermaLink="false">http://ditoinfo.wordpress.com/?p=85#comment-76</guid>
		<description>I try your suggestion but...
All groups end up with &quot;user_id = nil&quot;
Using factory_girl 1.2.0</description>
		<content:encoded><![CDATA[<p>I try your suggestion but&#8230;<br />
All groups end up with &#8220;user_id = nil&#8221;<br />
Using factory_girl 1.2.0</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: andy white</title>
		<link>http://danteregis.com/2008/11/factory-girl-and-has_many-has_many-through-associations/comment-page-1/#comment-75</link>
		<dc:creator>andy white</dc:creator>
		<pubDate>Wed, 11 Feb 2009 15:16:48 +0000</pubDate>
		<guid isPermaLink="false">http://ditoinfo.wordpress.com/?p=85#comment-75</guid>
		<description>If it wasn&#039;t for excellent people like you - who find an answer to an annoying problem like this and then publish it to the world - people like me would spend hours hitting our heads against a brick wall. I salute you!

Just started using Factory Girl and it looks really useful but, unless I&#039;m being thick, I couldn&#039;t find this in the rdoc.</description>
		<content:encoded><![CDATA[<p>If it wasn&#8217;t for excellent people like you &#8211; who find an answer to an annoying problem like this and then publish it to the world &#8211; people like me would spend hours hitting our heads against a brick wall. I salute you!</p>
<p>Just started using Factory Girl and it looks really useful but, unless I&#8217;m being thick, I couldn&#8217;t find this in the rdoc.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
