About a simple insert

It sounds like you should establish an association between the two models:

  class Client < ActiveRecord::Base
     has_many :details

  class Detail < ActiveRecord::Base
    belongs_to :client

This would require a client_id column in the details table.

Then, when the form is submitted, you would do something like:

  client = Client.new(params[:client])

The one save inserts both the clients and details rows.


Oh, I see what you're saying.

You should keep two separate objects for the purpose of the form:

(in controller)

   @client = Client.new
   @detail = Detail.new

Then in the view:

   <%= text_field :detail, :name %>

Before the save, you would add the detail to the client:

   @client.details << @detail