edit a model and its has_many children at once?

I know there has to be a way to do this. Is there any way to edit a
model, and its has_many children in a single view?


class Metadata
has_many :metadata_entries

If both Metadata and MetadataEntries have a 'label' attribute, what
would the view look like?

Here is my best guess, but this doesn't work:

<% form_for(@metadata) do |f| %>
   <%= f.text_field :label %>
   <p>try to marshal the data for each "metadata_entry" has_many
   <% @metadata.metadata_entries.each_with_index do |entry, index| %>
      <p>this is obviously wrong, how do I index this??</p>
      <input type="text"
   <% end %>
   <%= f.submit 'Update' %>
<% end %>

------end edit.html.erb----

I'm running ruby 1.8.6/Rails 2.3.2.

Thanks in advance for any and all pointers.

Try the new "accepts_nested_attributes_for" feature in rails 2.3

Sahil Dave,

  Ahh perfect. That makes sense.

Appreciate the help,

Sahil Dave wrote: