Rails 3 using fields_for in view doesn't work -


I am trying to apply master details in a Rail form with fields_for

My There is a model called Recipe:

  class recipe  

and a model named as RPIIID and END:

  class RecipeIngredient  

In the new controller, I populate the contents with three empty records like this:

  Def new @ recipes = recipe.new 3.times {@ recipe.recipe_ingredients.build} # @ toolization = recipeEngineAgentIt.New reply ReplyTo do it | Format | Format.html # new.html.erb format.xml {Render: xml = & gt; @Repp} End End  

Consumption field (which works properly) and what I want to do to see three areas for recipe content. At the top of the scene I have this:

  <% = form_for: rec do | F | & Gt%;  

Then I list the recipe areas that are displayed correctly, such as:

   

Then I try to display the component rows but the code never goes to field_ section:

First try:

< For ingredients in pre> and @ recipe <%> Recipe_tagration% & gt; This three times for "<... fields_", component component. Ingredient_form | & Gt%; But it does not print & lt; P & gt; Component: & lt;% = ingredient_form.text_field: Details% & gt; & Lt; / P & gt; & Lt;% end% & gt; & Lt;% end% & gt;

My recipe has three empty rows and it looks three times for the loop but the code never gets triggered within the field.

Try another:

recipe_ingredient @ recipe.recipe_greatings%> B. Lieutenant;% fields_for "...", Recipe_EADAdent. Recipe_indian | & Gt%; RE:

Third attempt (depending on the answer):

  & lt;% form_for: recipe do | F | & Gt%; For & lt;% f.fields_ content. Ingredient_form | & Gt%; & Lt; P & gt; Component: & lt;% = ingredient_form.text_field: Details% & gt; & Lt; / P & gt; & Lt;% end% & gt; & Lt;% end% & gt;  

Is there anything clear that I am doing wrong?

switch it

  and <% form_for: recipe do | F | & Gt%; For & lt;% f.fields_: Content Making | Factor-formula & Gt%; & Lt; P & gt; Component: & lt;% = ingredient_form.text_field: Details% & gt; & Lt; / P & gt; & Lt;% end% & gt; & Lt;% end% & gt;  

Comments