LoginSignup
2
0

More than 3 years have passed since last update.

rails APIモード+ActiveAdminで、管理者画面にてユーザーを削除しようとしたらNo route matchesのエラーが発生した際の対処法

Posted at

環境

  • Rails 5.2.3 (APIモード)
  • activeadmin (2.3.1)

事象

管理者画面(http://localhost:3000/admin/) にて、管理者を削除するボタンを押したところ、Routing Error No route matches [POST] "/admin/admin_users/2"が発生する。

原因

HTTPのPUTメソッド、DELETEメソッドを実現するためのミドルウェアであるRack::MethodOverrideが使用されていなかったため。

対応

  1. rake middlewareコマンドを実行し、Rack::MethodOverrideがないことを確認
  2. application.rbにconfig.middleware.use Rack::MethodOverrideを追加
class Application < Rails::Application
  (中略)
   config.middleware.use Rack::MethodOverride

参考

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0