Forms with nesting/composite models

I was wondering how best to handle forms where I'm presenting a model and some of its "children", i.e. a Person with multiple IM contacts or something. I had a look at some of the source in HighriseHQ, figuring hey, if anybody knew how to do it it was David himself, and I noticed something interesting. The models are roughly like this:

Person:     has_one :contact_data

ContactData:    belongs_to: person    has_many :instant_messengers    has_many :phone_numbers

InstantMessenger:    belongs_to :contact_data

If you look at the form when editing a person, you see stuff like this:

<select id="person_contact_data__phone_numbers__location" name="person[contact_data][phone_numbers][location]"><option value="Work" selected="selected">Work</option>

and even more nested, this:

<input id="instant_messenger_2406533_id" name="person[contact_data]

Hi Elan

Do you know Railscasts? (http://railscasts.com/) Ryan, in the last 3 episodes (complex forms), shows how to do this kind of stuf.

Okada.

Hey Carlos,

Thanks a lot for the tip, that's exactly what I was looking for!

-elan