I originally had a loop before reading about fields_for and went back
to it now:
= simple_form_for @response do |f|
- @questions.each do |q|
= q.questionfield
%br
= f.simple_fields_for :answers_attributes, :index=>q.id do |a|
= a.input :answerfield
= f.button :submit
Is what I have now, simplified to 1 level of nesting attributes. I
get this:
undefined method `create' for nil:NilClass
{"utf8"=>"✓",
"authenticity_token"=>"...",
"response"=>{"answers_attributes"=>{"1"=>{"answerfield"=>"sdfgsdfg"},
"2"=>{"answerfield"=>"45yewty"},
"3"=>{"answerfield"=>"dfgh"},
"4"=>{"answerfield"=>"dfsghdfg"}}},
"commit"=>"Create Response",
"survey_id"=>"1"}
Which is my next hurdle..processing this properly or determining how
exactly this is wrong
On Apr 14, 10:49 pm, RipTheJacker <[email protected]> wrote:
> You still need to loop through the questions.
> Here:http://railscasts.com/episodes/73-complex-forms-part-1
>
> On Apr 14, 11:09 am, none1 <[email protected]> wrote:
>
> > I've been banging my head against a wall for a bit and I need some
> > input and direction.
>
> > Some background:
>
> >http://stackoverflow.com/questions/5641966/rails-form-building-accept...
>
> > Trying to create a response form that lists each question and space
> > for an answer, I can't.
>
> > I've been looking for examples, but there are none. I've been poking
> > around the spec for dm-ana, but its a bit beyond me atm. To my
> > understanding using fields_for with :etc_attributes should pull up
> > something but I get nothing -- almost everything I've read is
> > ActiveRecord.
>
> > I'd be more than happy provide any exchange of information for some
> > guidance in creating multi-model forms with DM (is there another way
> > to this outside of dm-ana, what can I do to learn more, etc), this is
> > a serious hindrance to my current projects.
--
You received this message because you are subscribed to the Google Groups
"DataMapper" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/datamapper?hl=en.