如何获取嵌套控制器的destroy操作的link_to?

时间:2014-02-04 00:17:42

标签: ruby-on-rails ruby-on-rails-3 routes

如果我有以下嵌套路线:

  resources :teams do
    resources :team_memberships
  end

如何让link_to销毁特定的team_membership?

1 个答案:

答案 0 :(得分:1)

应该是这样的:

<%= link_to "remove", team_team_membership_path(@team, @membership), method: :delete, data: {confirm: 'Are you sure?'} %>

查看您的rake routes