Marnen Laibow-Koser wrote:

>   <input id="recipe_ingredient_lines__ingredient_name" name="recipe
> [ingredient_lines][][ingredient][name]" size="30" type="text" />
> 
> So far so good.  But here's the problem: *submissions don't work quite
> properly*.  When I fill out the form and submit it, I get params
> entries like
> "recipe"=>{"name"=>"Recipe", "ingredient_lines"=>[{"quantity"=>"1",
> "unit"=>"cup", "ingredient"=>{}}], "instructions"=>"Preheat oven to
> 350°..."}. Note that ingredient_lines[0].ingredient.name is missing,
> even if I enter text in the corresponding form field -- in other
> words, what I should be seeing is something like "recipe"=>
> {"name"=>"Recipe", "ingredient_lines"=>[{"quantity"=>"1",
> "unit"=>"cup", "ingredient"=>{"name" => "flour"}}],
> "instructions"=>"Preheat oven to 350°..."}.

I believe this is a limitation of Rails' parameter parsing.
It can't handle more that one level below an array parameter.

A solution is to create an ingredient_name accessor in
IngredientLine, and arrange to have this rendered and posted.

-- 
Rails Wheels - Find Plugins, List & Sell Plugins - http://railswheels.com

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to