简体   繁体   中英

How do I get a link_to the destroy action of a nested controller?

If I have the following nested route:

  resources :teams do
    resources :team_memberships
  end

How do I get a link_to destroy a specific team_membership?

Should be something like:

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

Look at your rake routes

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM