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

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to