Rails set values on form submit
===

I'm trying to auto fill a field when a drop down item is selected OR find and set the attributes when the create method is called. Specifically the mid (MachineID) located in a different class (Part). Partconfig belongs_to Part. Part has many Partconfig.  

PartConfig
 

    <div class="field">
      	<%= f.label :name %><br />
    	<%= f.select :Part_id, Part.all.collect{ |c| [c.name, c.id] } %>
      </div>
      <div class="field">
      	<%= f.label :mid %><br />
        <%= f.number_field :mid %>
      </div>

I thought I could do this in the create controller method:

     @part_config = PartConfig.new(params[:part_config])
     @part_config.mid = Part.find_by_name(params[:name]).select("mid")

Which does not work.