active admin と devise token authを併用していたところ、タイトルのエラーが出てきました

[toc]

解決策

解決策は簡単で、

  • 一つはAPI用のコントローラー
  • もうひとつは、devise token auth用のコントローラー

を作成することで解決するようです

コード

# app/controllers/api_controller.rb
# API routes extend from this controller
class ApiController < ActionController::Base
  include DeviseTokenAuth::Concerns::SetUserByToken
end

# app/controllers/application_controller.rb
# leave this for ActiveAdmin, and any other non-api routes
class ApplicationController < ActionController::Base
end

参考にした記事

I’m having trouble using this gem alongside ActiveAdmin…
↑結構下の方にあります
activeadmin with rails API app errors: ArgumentError in Admin::DashboardController#index

コメントをどうぞ

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

CAPTCHA