title: factory girl: association problem testing model which has validates_presence_of accepts_nested_attributes_for
body: <p>i have a simple associations:</p>
  
  <pre><code>class Account &lt; ActiveRecord::Base
    has_many :users
  
    accepts_nested_attributes_for :users
    validates_presence_of :users
  end
  </code></pre>
  
  <p>and</p>
  
  <pre><code>class User &lt; ActiveRecord::Base
    belongs_to :account
  end
  </code></pre>
  
  <p>i just want to run a simple test:</p>
  
  <pre><code>describe 'a new', Account do
    it 'should be valid' do
      Factory.build(:account).should be_valid
    end
  end
  </code></pre>
  
  <p>with the factories:</p>
  
  <pre><code>Factory.define :account do |a|
    a.name                 { Faker::Company.name }
  end
  
  Factory.define :user do |u|
    u.association           :account
    u.email                 { Faker::Internet.email }
  end
  </code></pre>
  
  <p>but i always run into this error:</p>
  
  <pre><code>'a new Account should be valid' FAILED
  Expected #&lt;Account id: nil, name: "Baumbach, Gerlach and Murray" &gt; to be valid, but it was not
  Errors: Users has to be present
  </code></pre>
  
  <p>well, i setup the correct associations, but it doesn't work...</p>
  
  <p>thx for your help.</p>