Multi-model forms

Hi

I’m trying to implement multi-model forms. Specifically a form
containing the following relationships …

parent -> children

child  -> grandchildren

[ NOTE : "->" denotes a one to many relationship / association -

the ‘>’ points to the many ]

Recipe #13 in Advanced Rails Recipes does a great job of explaining
how to implement the parent -> children relationship using Project
and Tasks. Specifically …

  project -> tasks  (using my "->" nomenclature)

I’d like to include an additional model - for example adding
“Participants” to the above example …

  project -> tasks

  task    -> participants

Where I’m getting stuck is what to use for the ‘prefix’ (using the
terminology of Recipe #13) - or what name to use to refer to
‘participants’, in such a way that the params hash is properly
populated for ‘auto-population’ by the controller?

Using the Project/Task metaphor and extending it to include the
relationship that a Task has many Participants, the ‘task’ partial
would look something like this (not in its final form - but early on
in the development of a +2 model multi-model form. Also note the
‘???’) …

<% fields_for "project[task_attributes][]", task do |f| %>

Task: <%= f.text_field :name %>

<% 3.times { task.participants.build } %>

<% for participant in task.participants %>

  <% fields_for "project[???????]", participant do |p_form| %>
    <p>
      Participant Name: <%= p_form.text_field :name  %>
    </p>
  <% end %>
<% end %>

<% end %>

I’m assuming that a Task can have at most 3 participants, like what
was done in the early iterations of Ryan Bate’s original screen-cast.

I’m trying to figure out how to name the ‘grandchildren’ such that
the params hash is correctly populated ? Specifically - what to put
in place of the ‘???’ in this line …

<% fields_for "project[???????]", participant do |p_form| %>

If the solution doesn’t involve replacing the ‘???’ above -
please point me in the right direction by providing as much detail /
info as you have time for.

I’m grateful for any help / guidance you can provide.

Thanks
Dave