Deeply nested form containing a nested form

烈酒焚心 提交于 2019-12-13 02:07:50

问题


I saw the railscast on using deeply nested forms to make a survey:
http://railscasts.com/episodes/196-nested-model-form-revised?view=asciicast

How would you construct something similar in Rails to actually /take/ the survey, instead of just construct it for display in text? How would you make a deeply nested form containing a survey form the user fills out?


回答1:


Couple things to consider: Use fields_for (this is to construct child form). Use nested_form to keep building child forms (n amount) - https://github.com/ryanb/nested_form



来源:https://stackoverflow.com/questions/13112741/deeply-nested-form-containing-a-nested-form

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!