title: rails 4 multiple models in one form including a key value table
body: <p>I have a form that creates a "talent profile". In this form as a separate model are attributes "height, weight, hair, etc." for the talent profile. However, there are actually 4 tables involved in this.</p>
  
  <p>Tables with examples<br/>
  <b>talent_profile</b><br/>
  id - 1</p>
  
  <p><b>talent_profile_attributes -</b>(links the talent to an attribute with a value)<br/>
  talent_id - 1<br/> 
  default_attribute_id - 2<br/>
  default_attribute_value_id - 3<br/></p>
  
  <p><b>default_attributes -</b><br/>
  id - 2<br/>  name - "hair"</p>
  
  <p><b>default_atrribute_values -</b><br/>
  id - 3<br/>  default_attribute_id - 2<br/>  value - "brown"<br/></p>
  
  <p><p>The relationships with the models are fine, I can insert into the table manually and retrieve the attributes for each profile as desired. However, the problem I am having is figuring out how to submit both the TalentProfile model, and the TalentProfileAttributes model in a single form.</p><p>
  I tried using accepts_nested_attributes_for, but have been unsuccessful. In addition I'm not quite sure how to approach getting the default_attribute_id and default_attribute_value_id into the fields of the form. Any ideas, or directions to go would be greatly appreciated, been researching this for a couple hours now to no avail. </p>
  
  <p>Basically Im looking for a form that displays all the values from the DefaultAttributes table, with dropdowns including the DefaultAttributeValue for each attribute, and when submitted, creates the relationships in the TalentProfileAttribute table.</p>