diff --git a/lib/jsonapi/resource_controller_metal.rb b/lib/jsonapi/resource_controller_metal.rb index e8dfb3f5..514b2b67 100644 --- a/lib/jsonapi/resource_controller_metal.rb +++ b/lib/jsonapi/resource_controller_metal.rb @@ -2,12 +2,20 @@ module JSONAPI class ResourceControllerMetal < ActionController::Metal + # ActionController::ForceSSL was removed in Rails 8.0 + # It existed in Rails < 6.1, and force_ssl is now integrated into ActionController::Base + FORCE_SSL_MODULE = if Gem::Requirement.new('< 6.1').satisfied_by?(ActionPack.gem_version) + defined?(ActionController::ForceSSL) ? ActionController::ForceSSL : nil + else + nil + end + MODULES = [ AbstractController::Rendering, ActionController::Rendering, ActionController::Renderers::All, ActionController::StrongParameters, - Gem::Requirement.new('< 6.1').satisfied_by?(ActionPack.gem_version) ? ActionController::ForceSSL : nil, + FORCE_SSL_MODULE, ActionController::Instrumentation, JSONAPI::ActsAsResourceController ].compact.freeze