帮助处理 Rails 嵌套表单
我有这三个型号。
学生。 评估。 成绩(student_id,evaluatioin_id,value)
我想制作一个表格,以便用户可以为评估的每个学生设置成绩...
我想保持尽可能干净(和安静)...
我开放有关如何完成此操作的任何建议。
请帮忙。
I have these three models.
Student.
Evaluation.
Grade (student_id, evaluatioin_id, value)
I want to make a form so that a User can set the grade for each student of a evaluation...
I want to keep this is as clean as possible (and restful)...
Im open to any suggestions on how to get this done.
Please Help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
请参阅这些
http://railscasts.com/episodes/196-nested-model -form-part-1
http://railscasts.com /episodes/197-nested-model-form-part-2
See these
http://railscasts.com/episodes/196-nested-model-form-part-1
http://railscasts.com/episodes/197-nested-model-form-part-2
我想您有以下关联:
评估:
学生:
年级:
关于您的评论,我认为您想使用nested_form_for 由 Ryan Bates 制作的 gem。它可以帮助您非常有效地在表单中添加/删除动态嵌套属性。您可以这样使用它:
告诉我它是否有效/适合您的需求。前几天我经常使用这个宝石。
I suppose you have the following associations:
Evaluation:
Student:
Grade:
Regarding your comment I think you want to use the nested_form_for gem made by Ryan Bates. It helps you add/delete dynamically nested attributes in your form, very efficiently. You can use it like this:
Tell me if it works/fits your needs. I have been using this gem a lot these previous days.
我最终做的是..
中的等级模型中
在EvaluationsController
视图
What I ended up doing was..
In Grade Model
In EvaluationsController
In View