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.
class Report < ActiveRecord::Base
class AnswerSingle < ActiveRecord::Base
<%= index+1 %>. <%= question.content %>
<%= f.fields_for :answer_singles do |answer| %> <%= answer.text_area :content %> <% end %><% end %>
it shows well but once submit it makes error
- Question 1
- Question 2
[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,