Updating mutiple tables from the same form

Hi Guys!

Does anyone have an idea on how to update fields in different tables
using a single form?

Say i have 3 tables and i wanted to create new entries and update them
from a single form. how can i build such a model?

diffent textboxes in the form should create new entries in the various
table with only a single create button click on one form.

Thanks

Tanzanite

Thanks!
I will try it and see how it works out.

tz

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| %>

Account Information

Package: <%= f.select :package, Account::PACKAGE_TYPES, :prompt => "Select a package" %>

Upgrade Database: <%= f.select :db_limit, Account::DATABASE_LIMITS, :prompt => "Select database limit" %>

Billing Information <% fields_for :billing_profiles do |billing_profile| %>

Name
<%= billing_profile.text_field :name %>

Email
<%= billing_profile.text_field :email %>

Business phone
<%= billing_profile.text_field :business_phone %>

Home phone
<%= billing_profile.text_field :home_phone %>

Company
<%= billing_profile.text_field :company %>

Address1
<%= billing_profile.text_field :address1 %>

Address2
<%= billing_profile.text_field :address2 %>

City
<%= billing_profile.text_field :city %>

State
<%= billing_profile.text_field :state %>

Zip
<%= billing_profile.text_field :zip %>

Country
<%= billing_profile.country_select :country, ["United States"] %>

<% end %>

<%= submit_tag "Upgrade My Account" %>

<% end %>

On Mar 8, 8:33 pm, Tanzanite T. <rails-mailing-l…@andreas-