>From earlier in the post-stream:

class FormController < ApplicationController
  def index
    @form = Form.find(:first)
    @form.update_attributes(params[:form])

    @detail = @form.detail
    @detail.update_attributes(params[:detail])
  end
end

>From your log:

{"commit"=>"Speichern", "action"=>"index",
"controller"=>"form", "form"=>{"kurztext"=>"This is a test for the
talk"}, "detail"=>{"detailtext"=>"Test for the talk"}}


Something is truly bizarre with this example you are trying
to follow... and I can't say that I fathom the intent of
the example in the tutorial. So I went to look, and found a
PDF about Rails at video2brain, but unfortunately, Ich spreche
kein Deutsches.

Strange issues with this example:

You generally don't POST to the index method...  that's
usually a GET.

This code will always be modifying the first form due to the
Form.find(:first) statement... perhaps there is only supposed to
be one.

The detail model in params doesn't contain a form_id.  You could
remedy that by:

@form = Form.find(:first)
@form.update_attributes(params[:form])

if @form.detail
  @detail = @form.detail
else
  @detail = Detail.new
end

@detail.form_id = @form.id
@detail.update_attributes(params[:detail])

That should at least get you a value for form_id in
the detail model (you did add form_id as integer to your
details table, no?))

But this example is "wrong" in so many ways.  Finish it if you must,
then promptly forget this video2brain... gibberish.

Step up to Rails3, and find a couple of Rails 3 tutorials. You'll be
much better served spending your time on those.
-- 
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