How can I use aggregation objects in form_for?

Say I have a person object which has a aggregation object call
address. The the code to manipulate a form for create a new person
should be:

new.rhtml

<% form_for :person, :url => {:action => ‘create’} do |f| %>
<%= render :partial => ‘form’, :locals => {:f => form} %>
<%= submit_tag “Create” %>
<% end %>

_form.rhtml

Name
<%= form.text_field :name %>

Country
<%= form.text_field :country %>

City
<%= form.text_field :city %>

This does work. But country and city belong to the aggregation object
address and I want to use address in the form. According to RDoc and
rails book. The above text_field helper method will generate and rails will recognize it and translate it
into :person => {:name}. And if I can generate something like , then rails will get :person =>
{:address => {:country}}, which is exactly what I want. How can I tell
rails to generate this kind of input for me? I cannot find any
information about this in RDoc. Thanks a lot.

There is ‘fields_for’ which behaves the same as ‘form_for’ but without
wrapping the block in a form tag.

<%= fields_for @model.aggregation, … do |subform|%>

<% end %>