I think helping you would be easier when knowing the code of the action that processes the form input. Could you please provide that too?
-- send by Samsung Galaxy Tab with Overcome Mod Am 18.10.2011 14:09 schrieb "Hakjune Kim" <[email protected]>: > Hello Please help me to find this code work. > > I'm trying to make a report with predefined questions. > I have made questions from the scaffold and filled it. > Now is to assign answer fields per each questions. > > [DATA TYPE] > class Report < ActiveRecord::Base > has_many :answer_singles > end > > class AnswerSingle < ActiveRecord::Base > belongs_to :report > end > > reports/_form.html.erb > <div class="question"> > <% QuestionSingle.all.each_with_index do |question, index| %> > <p><%= index+1 %>. <%= question.content %></p> > <p> > <%= f.fields_for :answer_singles do |answer| %> > <%= answer.text_area :content %> > <% end %> > </p> > <% end %> > </div> > > it shows well but once submit it makes error > 1. Question 1 > [text area] > 2. Question 2 > [text area] > > [error when submit] > AnswerSingle(#18194030) expected, got Array(#1133380) > > I think the reason is using :answer_singles for fields for. > Is there any better code to implement this? > > Thank you and regards, > June > > -- > 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 [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > > -- 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

