On Thu, Jul 17, 2008 at 12:14 PM, Clemens <[EMAIL PROTECTED]> wrote: > > I'm generally in favor of this for pretty much the same reason as > Hique. > One thing, though: If this kind of behavior was merged into core, the > fields_for method should also be updated to accept an array as its > first parameter to facilitate the use of nested hashes. > > Right now, we have to do something like the following: > <% form_for :product do |f| %> > <p><%= f.text_field :name %></p> > <% fields_for "product[price]" do |f| -%> > <p><%= f.text_field :quantity %></p> > <p><%= f.text_field :price %></p> > <% end -%> > <% end %> > > It would be great to have it like this: > <% form_for :product do |f| %> > <p><%= f.text_field :name %></p> > <% fields_for [:product, :price] do |f| -%> > <p><%= f.text_field :quantity %></p> > <p><%= f.text_field :price %></p> > <% end -%> > <% end %>
Bit late to the party I know, but can't you just do: <% form_for :product do |product| %> <%= product.text_field :name %> <% product.fields_for :price do |price| %> <%= price.text_field :quantity %> <% end %> <% end %> I hope you can, because I've been using it in apps for ages! Tom --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---