title: rails 3 - FactoryGirl create associated records
body: <p>I am trying to create some test data to fill my tables with so that i can test functionality on my site.</p>
  
  <p>The tables in question are: <code>songs</code>, <code>song_arrangements</code>, and <code>song_arrangement_files</code>.  The are associated in this way.</p>
  
  <pre><code>Songs:
      has_many :song_arrangements, :dependent =&gt; :destroy
      has_many :song_arrangement_files, :through =&gt; :song_arrangements
  
  Song Arrangements:
      belongs_to :song
      has_many :song_arrangement_files, :dependent =&gt; :destroy
  
  Song Arrangement Files:
      belongs_to :song
      belongs_to :song_arrangement
  </code></pre>
  
  <p>I have been able to create 25 songs with FactoryGirl with this code:</p>
  
  <pre><code>Code in my spec file:
      before { FactoryGirl.create_list(:song, 25) }
  
  Code in the factory:
      FactoryGirl.define do
          factory :song do |s|
              s.sequence(:title) { |n| "Song Title #{n}" }
              s.sequence(:artist) { |n| "Song Artist #{n}" }
          end
      end
  </code></pre>
  
  <p>Any thoughts on how to create <code>song_arrangements</code> and <code>song_arrangement_files</code> that are correctly assciated with their respective <code>song_arrangement</code> or <code>song</code> record?</p>
  
  <p>I'm guessing i could use <code>after(:create)</code> nested in my factory somehow.  I'm very new to FactoryGirl and still fairly new to Rails in general.  Any help is much appreciated!</p>