From ab9f44835e6bf30da7614352e1ac79520fff6604 Mon Sep 17 00:00:00 2001 From: David Revelo Date: Sun, 7 Aug 2022 13:51:34 +0200 Subject: [PATCH] Use controller set on devise config as the base controller for the engine --- app/controllers/graphql_devise/application_controller.rb | 5 +---- spec/dummy/app/controllers/application_controller.rb | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/app/controllers/graphql_devise/application_controller.rb b/app/controllers/graphql_devise/application_controller.rb index 2c9a3722..ade745e1 100644 --- a/app/controllers/graphql_devise/application_controller.rb +++ b/app/controllers/graphql_devise/application_controller.rb @@ -1,9 +1,6 @@ # frozen_string_literal: true module GraphqlDevise - ApplicationController = if Rails::VERSION::MAJOR >= 5 - Class.new(ActionController::API) - else - Class.new(ActionController::Base) + class ApplicationController < Devise.parent_controller.constantize end end diff --git a/spec/dummy/app/controllers/application_controller.rb b/spec/dummy/app/controllers/application_controller.rb index 280cc28c..0e622da7 100644 --- a/spec/dummy/app/controllers/application_controller.rb +++ b/spec/dummy/app/controllers/application_controller.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true class ApplicationController < ActionController::Base - protect_from_forgery with: :exception + protect_from_forgery with: :null_session end