Re: Help with nested models and fields_for

Mark Reginald James
Mon, 22 Dec 2008 06:22:28 -0000

Marnen Laibow-Koser wrote:
>
> On Dec 21, 11:42 am, Mark Reginald James
<m...-bzGI/hKkdgQnC9Muvcwxkw@public.gmane.org> wrote:
>> Marnen Laibow-Koser wrote:
>>>> It can''t handle more that one level below an array
parameter.
>>> Are you sure?  I''ve seen a few examples on the Web which
imply that
>>> this should work.
>> I can confirm that it''s broken in Rails 2.0.2, and fixed
>> in Rails >= 2.1.0.
>
> Then something else is going on.  I''m using Rails 2.2.2 and having
> these problems.
>
> [...]
>> objects[][foo] works, but objects[][foo][bar] did not.
>
> And still apparently does not.  Any other thoughts?

The test I did was to post from the following view.


<input name="recipe[ingredient_lines][][ingredient][name]"
type="text"/>


On Rails >= 2.1 I got the correct
"recipe"=>{"ingredient_lines"=>[{"ingredient"=>{"name"=>"hhh"}}]}

on 2.0.2 I got what you''re seeing:
"recipe"=>{"ingredient_lines"=>[{"ingredient"=>{}}]}

You may like to run the same test.

If you see the same, perhaps the problem manifests when extra
parameters are added. You can try adding fields until you
are posting your complete form.  Please post what you find out.

--
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org