title: Rails Complex Form is Failing to Save Due to Parent ID Being Blank
body: <p>I'm using rails 4.2.4, Ruby 2.2.1p85 and MySQL 5.5.</p>
  
  <p>I'm having an issue getting a rails complex form to save due to the parent object's id being blank.  Of course its blank it has not been created yet.  I have a list of countries already in the database and am attempting to add one to a newly created facility.  Each facility belongs to a country.  The facility is the parent form and the fields_for contains the following:</p>
  
  <pre><code>  &lt;%= f.fields_for :country do |country| %&gt;
  &lt;div class="form-group"&gt;
    &lt;%= country.label :Country, 'Facility Country:' %&gt;
    &lt;%= country.select :id, options_from_collection_for_select(@countries, 
        "id", "name"), {include_blank: "Select a Country..."}, {class: "form-control"} %&gt;
  &lt;/div&gt;
  </code></pre>
  
    
  
  <p>Here is the error:
  ActiveRecord::RecordNotFound in BbcFacilitiesController#create
  Couldn't find BbcCountry with ID=3 for BbcFacility with ID=</p>
  
  <p># POST /facilities.json
    def create
      @facility = Facility.new(facility_params)</p>
  
  <pre><code>respond_to do |format|
    if @facility.save
  </code></pre>
  
  <p>It's getting the correct country id in the params object, but since the facility has not yet been created it doesn't know what to do.  It just attempts to save it with a blank id in facility.  How can I resolve this issue?  Thanks.</p>