Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 Rails 4 和 ActsAsList gem 给我们的项目模型一个位置。项目可以由我的一个用户拥有,并与许多用户协作。当用户重新订购他们的项目时,它会影响协作者的项目顺序,这是一种意想不到的副作用。有没有解决的办法?
更新 根据@nate 的建议,我将:position列从Project模型移动到模型,它是和Collaboration之间的连接表。然后我包含在模型中并将其从模型中删除。现在每个都有through并且每个的位置都限定在.ProjectUseracts_as_list scope: :user_idCollaborationProjectuserprojectscollaborationsprojectuser
:position
Project
Collaboration
User
acts_as_list scope: :user_id
user
projects
collaborations
project