Wednesday 15 January 2014

ruby - Rails Creating a form where entries are saved to different rows in a table -


I am trying to create a survey form in the rail, there are many questions in the form, which are created by the administrator, and There is a "Answer" text field. I have a survey, question and answer model setup, however, I can not get the form to display as desired.

  Survery.rb: has_many: questions Question.rb #question_text: string # enabled: boolean related_to: survey reply .bb 

Right now, I have a separate "Save" button for each question / answer, however, I would like to do that a "Submit" button will save all the entries of its related lines in DB With whom I have some problems. I thought about using accepts_nested_attributes_ to accept documentation / examples, I do not think it works in this case.

Do anyone have some suggestions about this? Regards,

As Arjan had mentioned in his first comment on my question, Accepted-accepted_data for this case, I just need to read through the RailCast link in more detail:

(This was more helpful in my case)

and apply them to my objects correctly for the first time I tried to do it, I think B My models were not set correctly once I make the right relationships between the various models, it worked as expected.

No comments:

Post a Comment