4

我在多對多鏈接表上有額外的position屬性。其目的是在Group中定義Item的手動位置。鏈接模型被稱爲ItemGroupMembership正確的Rails方式來刪除鏈接表上的額外屬性

我允許用戶在Backbone應用程序中通過jQuery UI排序對其進行編輯。

什麼是更新此屬性的正確方法。我是否像普通模型一樣對待鏈接表,並擁有item_group_memberships_controller

回答

0

Item是如何分配給組的? 這應該在item_group_memberships_controller中完成。

所以,

class ItemGroupMembershipsController < Applicationontroller 

def create 
    #create the relationship, passing in :position 
end 

def update 
    #update the relationship by updating position 
end 

end 
相關問題