Sven Wildermann wrote:
class FormController < ApplicationController def index @form = Form.find(:first) @form.update_attributes(params[:form])
@detail = @form.detail @detail.update_attributes(params[:detail]) end end
IIRC, given the code above as the main clue, you might need:
class form < ActiveRecord::Base # a form model has a related detail model has_one :detail end
class detail < ActiveRecord::Base # and vice-versa belongs_to :form end
The details table needs to have a column named form_id, spec'ed as integer, the forms table gets no additional field.
If there can be more than one detail model related to a form, then just the form model specification changes... it notes has_many, and the related model is pluralized.
class form < ActiveRecord::Base # a form model has a related detail model has_many :details end