All threads / Why is a GET verb being used?

Ask A Question

Notifications

You’re not receiving notifications from this thread.

Why is a GET verb being used?

Michael Toth asked in Rails

I have the following error occurring after selecting a link.

ActionController::RoutingError (No route matches [GET] "/admins/delete_user"):

But the link is constructed as follows:

<td><%= link_to "Delete", "/admins/delete_user?id=#{u.id}", :method=>"post",
            :confirm=>"Are you sure?", :remote=>:true, :class=>"alert" %>

Why is the controller trying to use GET? Any ideas?

What does your routes.rb file look like?

I would run a rake routes | grep admins and see what is displayed.

Is the /admin route supposed to have an s? (/admins)

Easier to debug with the routes file content

Join the discussion

Want to stay up-to-date with Ruby on Rails?

Join 33,665+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    logo Created with Sketch.

    Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

    © 2020 GoRails, LLC. All rights reserved.