<?xml version="1.0" encoding="UTF-8"?>
<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom">
  <title>Textmode - Factory Girl - Rails fixture replacement Comments</title>
  <id>tag:textmode.at,2010:/2008/6/12/factory-girl-rails-fixture-replacement/comments</id>
  <generator version="0.8.0" uri="http://mephistoblog.com">Mephisto Drax</generator>
  <link href="http://textmode.at/2008/6/12/factory-girl-rails-fixture-replacement/comments.xml" rel="self" type="application/atom+xml"/>
  <link href="/2008/6/12/factory-girl-rails-fixture-replacement" rel="alternate" type="text/html"/>
  <updated>2009-06-25T14:45:30Z</updated>
  <entry xml:base="http://textmode.at/">
    <author>
      <name>Umuro</name>
    </author>
    <id>tag:textmode.at,2008-06-12:500:1141</id>
    <published>2009-06-25T14:45:30Z</published>
    <updated>2009-06-25T14:45:30Z</updated>
    <category term="Programming"/>
    <category term="Ruby on Rails"/>
    <category term="Web"/>
    <link href="http://textmode.at/2008/6/12/factory-girl-rails-fixture-replacement" rel="alternate" type="text/html"/>
    <title>Comment on 'Factory Girl - Rails fixture replacement' by Umuro</title>
<content type="html">&lt;p&gt;And moreover, in addition to that, we can enhance factories with their own helper methods.  To design clean and complicated factories &#8211; http://conceptspace.wikidot.com/blog:39&lt;/p&gt;


	&lt;p&gt;Factory.define :child do |f|
end&lt;/p&gt;


	&lt;pre&gt;&lt;code&gt;class &amp;lt;&amp;lt; f
    #do whatever you can do in a normal class definition
    def default_parent
        @default_parent ||= Factory(:parent)
    end
end&lt;/code&gt;&lt;/pre&gt;


	&lt;pre&gt;&lt;code&gt;f.sequence(:name) {|n| &quot;Child#{n}&quot;}
f.parent_id { f.default_parent.id }&lt;/code&gt;&lt;/pre&gt;</content>  </entry>
</feed>
