1

I'm using ActiveAdmin (master) on Rails 4.2 with rails-api. I've done all the proper configuration so that AA works properly. I can use index pages, show, use the edit form, etc. But when it comes time to take a destructive action, for some reason AA uses POST instead of the proper http verb. The result is a 404:

No route matches [POST] "/admin/admin_users/1"

When I copy the request as a cURL via the chrome console, modify the HTTP method from POST to DELETE, everything works properly and the user is deleted. So why is ActiveAdmin using POST?

2 Answers 2

3

I needed to add the Rack::MethodOverride to my middleware stack (you can confirm it's missing by running rake middleware).

Add it like so:

# config/application.rb
module MyApi
  class Application < Rails::Application
    config.middleware.use Rack::MethodOverride
  end
end
Sign up to request clarification or add additional context in comments.

Comments

0

I had this same issue, using activeadmin 1.0.0 and Rails 5.0.2. The form has the correct html, but the controller was receiving a POST:

<input type="hidden" name="_method" value="patch">

I checked, the Rack::MethodOverride middleware was in place.

My issue was fixed by correcting the permit_params: https://github.com/activeadmin/activeadmin/blob/master/docs/2-resource-customization.md#setting-up-strong-parameters.

I do not understand how that affects the POST/PATCH, but it did.

1 Comment

I am facing the same issue, I also have strong parameters. Could you please help me how can i resolve this issue?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.