Re: Help with nested models and fields_for

Mark Reginald James
Tue, 23 Dec 2008 03:39:54 -0000

Marnen Laibow-Koser wrote:

> Thanks for the suggestion.  I tried the same test, and got interesting
> if disheartening results.  When I had recipe[ingredient_lines][]
> [ingredient][name] as the only form field, I got the same results as
> you.  But the moment I added recipe[ingredient_lines][][unit],
> [ingredient][name] stopped working.  This was true both with Rails
> 2.1.2 and 2.2.2.  I think I may be running into a bug in Rails.

Thanks for running that test.

Below is a patch that seems to fix the problem.  I haven''t
yet run the rails test suite on it, nor added a test that would
have broken the original.

Just run the patch command in actionpack-2.2.2/lib/action_controller

--- request.rb  2008-12-23 13:07:00.000000000 +1100
+++ request.rb.new      2008-12-23 14:37:30.000000000 +1100
@@ -811,9 +811,9 @@
                top[-1][key] = value
              else
                top << {key => value}.with_indifferent_access
-              push top.last
-              value = top[key]
              end
+            push top.last
+            value = top[key]
            else
              top << value
            end

--
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