ruby-on-railsruby-on-rails-4acts-as-list

Rails gem acts_as_list, scoping the position to the user


I am using Rails 4 and the ActsAsList gem to give our Project model a position. Projects can be owned my one user, and collaborated on with many users. When a user re-orders their projects, it affects the project order for the collaborators as an unintended side-effect. Is there a way around this?


Solution

  • UPDATE Based on @nate's suggestion, I moved the :position column from the Project model to the Collaboration model which is the join table between Project and User. Then I included acts_as_list scope: :user_id on the Collaboration model and removed it from the Project model. Now each user has projects through collaborations and the position of each project is scoped to the user.