From a7d627ef01f7f168b6766ccfb5c80c2346449445 Mon Sep 17 00:00:00 2001 From: Wolfgang Wedelich-John Date: Fri, 11 May 2018 10:21:52 +0200 Subject: [PATCH] support for ActionController::API --- lib/acts_as_api.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/acts_as_api.rb b/lib/acts_as_api.rb index 8817e8d..4cd3e84 100644 --- a/lib/acts_as_api.rb +++ b/lib/acts_as_api.rb @@ -53,8 +53,9 @@ module ActsAsApi Mongoid::Document.send :include, ActsAsApi::Adapters::Mongoid end -# Attach ourselves to the action controller of Rails -if defined?(ActionController::Base) - ActionController::Base.send :include, ActsAsApi::Rendering +# Attach ourselves to the controller classes (Base and API) of Rails +if defined?(ActionController::Base) || defined?(ActionController::API) + ActionController::Base.send :include, ActsAsApi::Rendering defined?(ActionController::Base) + ActionController::API.send :include, ActsAsApi::Rendering defined?(ActionController::API) ActsAsApi::RailsRenderer.setup end