updating mutiple tables from the same form

You have to use the fields_for tag for this, in the following code I have two models. One for account and the other is for BillingProfile. This code uses Rails 1.2.2.

<%= error_messages_for :account %>

<% form_for :account, @a, :url => account_path(@account), :html => { :method => :put } do |f| %>   <fieldset>   <legend>Account Information </legend>   <p>     <label for="package">Package:</label>     <%= f.select :package, Account::PACKAGE_TYPES, :prompt => "Select a package" %>   </p>

  <p>     <label for="db_limit">Upgrade Database:</label>     <%= f.select :db_limit, Account::DATABASE_LIMITS, :prompt => "Select database limit" %>   </p>   </fieldset>

  <fieldset>   <legend>Billing Information</legend>   <% fields_for :billing_profiles do |billing_profile| %>   <p>      <b>Name</b><br />      <%= billing_profile.text_field :name %>    </p>    <p>      <b>Email</b><br />      <%= billing_profile.text_field :email %>    </p>    <p>      <b>Business phone</b><br />      <%= billing_profile.text_field :business_phone %>    </p>    <p>      <b>Home phone</b><br />      <%= billing_profile.text_field :home_phone %>    </p>    <p>      <b>Company</b><br />      <%= billing_profile.text_field :company %>    </p>    <p>      <b>Address1</b><br />      <%= billing_profile.text_field :address1 %>    </p>    <p>      <b>Address2</b><br />      <%= billing_profile.text_field :address2 %>    </p>    <p>      <b>City</b><br />      <%= billing_profile.text_field :city %>    </p>    <p>      <b>State</b><br />      <%= billing_profile.text_field :state %>    </p>    <p>      <b>Zip</b><br />      <%= billing_profile.text_field :zip %>    </p>    <p>      <b>Country</b><br />   <%= billing_profile.country_select :country, ["United States"] %>    </p>   <% end %>   </fieldset>   <p>       <%= submit_tag "Upgrade My Account" %>     </p> <% end %>