Commit cf9aa579 authored by Eric Guo's avatar Eric Guo Committed by Alessandro Rodi
Browse files

#457 Add Rails 5 API support in proper way (#457)

parent e337b098
......@@ -384,9 +384,12 @@ module CanCan
end
end
if defined? ActionController
%w[Base API].each do |klass|
next unless ActionController.const_defined?(klass)
ActionController.const_get(klass).class_eval { include CanCan::ControllerAdditions }
if defined? ActionController::Base
ActionController::Base.class_eval do
include CanCan::ControllerAdditions
end
elsif defined? ActionController::API
ActionController::API.class_eval do
include CanCan::ControllerAdditions
end
end
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment