title: How to specify the association with factory_bot?
body: <p>For example I have two models a user and a post. A post belongs_to a user and a user has many posts</p>
  <pre><code>#spec/factories/post.rb
  FactoryBot.define do
    factory :post do
      user
      body Faker::Movie.quote
      posted_at &quot;2018-04-03 13:33:05&quot;
    end
  end
  
  #spec/factories/user.rb
  FactoryBot.define do 
    factory :user do 
      first_name 'Jake'
    end
  end
  </code></pre>
  <p>Using Rspec in a test I want to do this:</p>
  <pre><code>user = create(:user, first_name: 'Barry') #id 1
  post = create(:post, user: user)
  </code></pre>
  <p>I would expect that the user_id of post to be 1 however it is creating another user prior and the user_id is 2.</p>
  <p>How can you specify the association when you are creating the object with factory_bot / factory_girl?</p>