title: Rails - Assign foreign key to an associated record that is created in the same form
body: <p>Is it possible in Rails3.2 to assign a foreign key <code>foo_id</code> to a record in the <code>Bar</code> table when both the <code>Foo</code> and <code>Bar</code> objects are created in the same create action?</p>
  
  <p>e.g.</p>
  
  <pre><code>@whatever = Whatever.new
  @whatever.build_foo
  @whatever.build_bar
  </code></pre>
  
  <p>Is it possible to do an <code>after_create</code> callback to update the <code>foo_id</code> attribute after the create action has been run?</p>
  
  <p>Any help appreciated.</p>