I'm doing a data entry form for a survey-ish application.
Relevant models are 

  EvalSheet     has_many   :eval_responses
  EvalResponses belongs_to :eval_sheet

A sheet just serves to let us enter (and reconstruct)
the response data per real-life survey sheet.

I'd like to gather all the responses for one sheet, then
in one go create the parent and all necessary children.

I've tried a few things with form_for, pointing it at
both types of object.  EvalSheet seems like the "right" one,
but I can't figure out how to tell it to create the right kind
of input tag names.

The idea for the handling action is something like:

  ------------------------
  sheet = EvalSheet.new

  for response in params[:eval_sheet][:eval_responses] do
    r = EvalResponse.new(response)
    sheet.eval_responses << r
  end

  sheet.save
  ------------------------

The raw form tag names I need in order to create what I think
is the the right params hash are like this:  

 <input type="text" name="eval_sheet[eval_responses][][response]" />

That inner "[]" seems to be what I need to get an array
into the right place in the params hash.

Any hints on how I would use form_for and text_field to
generate that input element though?

Thanks in advance...

                -glenn
_______________________________________________
Sdruby mailing list
[email protected]
http://lists.sdruby.com/mailman/listinfo/sdruby

Reply via email to