Forum: Ruby on Rails Re: ", '@item') %> (working on it)

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
benanderson.us (Guest)
on 2005-11-24 15:53
(Received via mailing list)
ok, so I'm playing with the source now and have gotten this working
(at least on the output side of things).

So my example of:
<% for @order in @orders %>
 ...
 <%= text_field("order[]", 'name') %>
 ...
 <% for @item in @order.items %>
   ...
   <%= text_field("order[]item[]", 'name') %>

yeilds something like this:
  <input type="text" name="order[1][name]" ...
  <input type="text" name="order[1]item[1][name]"...
  <input type="text" name="order[2][name]" ...
  <input type="text" name="order[2]item[1][name]"...
  <input type="text" name="order[2]item[2][name]"...

Before I start working on loading this back into model objects upon a
submit, does anyone have any thoughts on this approach?  This
functionality wasn't left out for any particular reason, was it?

Thanks,
Ben
This topic is locked and can not be replied to.