在链接表上 CRUD 额外属性的正确 Rails 方法
我的多对多链接表上有一个额外的 position
属性。其目的是定义 Group
中 Item
的手动排序位置。该链接模型称为 ItemGroupMembership
。
我允许用户在 Backbone 应用程序中通过 jQuery UI 可排序来编辑它。
更新此属性的正确方法是什么?我是否将链接表视为常规模型并拥有 item_group_memberships_controller
?
I have an extra position
attribute on my many-to-many link table. Its purpose is to define hand-ordered position of an Item
in a Group
. The link model is called ItemGroupMembership
.
I am allowing the user to edit this by jQuery UI sortables in a Backbone application.
What is the correct way to update this attribute. Do I treat the link table like a regular model and have a item_group_memberships_controller
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,项目是如何分配给组的?
这应该在
item_group_memberships_controller
中完成。所以,
How are Item's assigned to Groups in the first place?
This should be done in the
item_group_memberships_controller
.So,