title: Cannot get simple_nested_form to submit data
body: <p>I am trying to build a simple_nested_form in my Ruby on Rails app.  When I submit my form I am getting some unknown error because it is just redirecting back to the form to input again.  Here is the output in the rails server console for when I submit the form.  It looks like there is some random "0" => thrown in there.</p>
  
  <pre><code>Parameters: {"machine"=&gt;{"name"=&gt;"2134", "ip_adress"=&gt;"2", "machine_employees_attributes"=&gt;{"0"=&gt;{"machine_id"=&gt;"1", "employee_id"=&gt;"2"}}}, "commit"=&gt;"Create Machine"}
  </code></pre>
  
  <p>I have a machine model which has_many :machine_employees</p>
  
  <p>and a machineemployee model which belongs_to :machine</p>
  
  <p>Do you have any idea why this 0 => could be appearing because I think it is what is giving me the issues.</p>
  
  <p>Here is the code for my models.</p>
  
  <p>Machine</p>
  
  <pre><code>class Machine &lt; ActiveRecord::Base
  
  # Relationships
  has_many :machine_employees
  has_many :employees, :through =&gt; :machine_employees
  
  accepts_nested_attributes_for :machine_employees, :reject_if =&gt; lambda{ |me| me[:employee_id].blank? }
  
  attr_accessible :ip_adress, :name, :machine_employees_attributes
  
  
  # Validations
  validates_presence_of :name, :ip_adress
  end
  </code></pre>
  
  <p>MachineEmployee</p>
  
  <pre><code>class MachineEmployee &lt; ActiveRecord::Base
  before_validation :set_default
  
  # Relationships
  belongs_to :machine
  belongs_to :employee
  
  attr_accessible :employee_id, :machine_id, :end_date, :start_date
  
  # Validations
  validates_presence_of :employee_id, :machine_id, :start_date
  
  private
  
  # Callback Methods
  def set_default
    self.start_date = Date.today
    self.end_date = nil
  end
  
  end
  </code></pre>
  
  <p>New Machine Form</p>
  
  <pre><code>&lt;div class="row-fluid"&gt;
  
  &lt;div class="span3"&gt;
  
      &lt;h1&gt;Add a Machine&lt;/h1&gt;
  
      &lt;br /&gt;
  
      &lt;%= simple_nested_form_for @machine do |f| %&gt;
          &lt;%= render "machine_fields", :f =&gt; f %&gt;
          &lt;%= f.button :submit %&gt;
          &lt;%= link_to 'Back', machines_path %&gt;
  &lt;/div&gt;
  
  &lt;div class="span4"&gt;
      &lt;h4&gt;Assign an Employee to This Machine&lt;/h4&gt;
      &lt;%= f.simple_fields_for :machine_employees do |me_form| %&gt;
          &lt;!-- render nested machine_employee fields--&gt;
          &lt;%= render "machine_employee_fields", :f =&gt; me_form %&gt;
      &lt;% end %&gt;
  &lt;/div&gt;
  &lt;% end %&gt;
  
  &lt;/div&gt;
  </code></pre>
  
  <p>Machine Employee Fields Partial</p>
  
  <pre><code>&lt;%= f.input :machine_id, :as =&gt; :hidden, :input_html =&gt; { :value =&gt; @machine.id } %&gt;
  &lt;%= f.input :employee_id, collection: @employees, :id =&gt; :name, :prompt =&gt; "Select ..." %&gt;
  </code></pre>