Ruby on rails 如何让acts_as_列表通过关联与多人合作?

Ruby on rails 如何让acts_as_列表通过关联与多人合作?,ruby-on-rails,ruby,ruby-on-rails-4,has-many-through,relationships,Ruby On Rails,Ruby,Ruby On Rails 4,Has Many Through,Relationships,我不知道如何通过关联将拖放添加到has\u MUN 我有一个董事会模型,每个董事会都有许多列表 每个列表都有许多卡片,并且每个卡片通过一个称为ListCard的连接模型有许多列表 我正在尝试添加拖放到每个列表上的卡。我的前端使用jQueryUI,但我不知道如何通过ajax将位置保存到我的ListCard模型中的位置整数列 我看了下面这些,但我不知道如何通过关联设置控制器 型号 class List < ActiveRecord::Base belongs_to :user

我不知道如何通过关联将拖放添加到has\u MUN

我有一个董事会模型,每个董事会都有许多列表

每个列表都有许多卡片,并且每个卡片通过一个称为ListCard的连接模型有许多列表

我正在尝试添加拖放到每个列表上的卡。我的前端使用jQueryUI,但我不知道如何通过ajax将位置保存到我的ListCard模型中的位置整数列

我看了下面这些,但我不知道如何通过关联设置控制器

型号

class List < ActiveRecord::Base
    belongs_to :user
    belongs_to :board

    has_many :list_cards, dependent: :destroy
    has_many :cards, through: :cards
    accepts_nested_attributes_for :list_cards
end

class ListCard < ActiveRecord::Base
  belongs_to :list
  belongs_to :card

  acts_as_list :scope => :list_card
end

class Card < ActiveRecord::Base
    belongs_to :user

    has_many :list_cards
    has_many :lists, through: :list_cards
    accepts_nested_attributes_for :list_cards
end
resources :boards do
  resources :lists do
    collection { post: sort }
  end
end

resources :cards 
列出控制器

def sort
  # not sure what to put here
  render nothing: true # this is a POST action, updates sent via AJAX
end
董事会展示页面(例如www.example.com/Board/1)

<% @lists.each do |list| %>
  <ul id="cardwrap">

     <%= list.title %> 

     <% list.cards.each do |card| %>

     <%= content_tag_for :li, card do %>
       <%= card.title %>
     <% end %>

  </ul>
<% end %> 
jQuery -> 
    $('cardwrap').sortable
      axis: 'y'
      update ->