Skip to content

Commit

Permalink
support for ActionController::API
Browse files Browse the repository at this point in the history
  • Loading branch information
Wolfgang Wedelich-John committed May 11, 2018
1 parent 874ccfb commit a7d627e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/acts_as_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit a7d627e

Please sign in to comment.