Tyler
Tyler

Reputation: 2386

How to do delete link in rails with modules

So I am unsure of the syntax for the delete record link because I have modules for the routes

namespace :api do
  namespace :v1 do
    resources :invites do
      collection do
        post "by_user_id"
      end
    end
  end
end

This is the syntax for the delete method right now

<td><%= link_to 'Destroy', invite, method: :delete, data: { confirm: 'Are you sure?' } %></td>

Also I am using rails 4

Upvotes: 0

Views: 40

Answers (1)

Mehul Gurjar
Mehul Gurjar

Reputation: 284

Please check routes via rake routes DELETE method for invites resource.

Then insert your routes below in place of "your_routes_path"

<td><%= link_to 'Destroy', your_routes_path, method: :delete, data: { confirm: 'Are you sure?' } %></td>

Upvotes: 1

Related Questions