尝试使用ActionController :: API创建gem时出现错误。
NameError(未初始化的常量Health :: ActionController)
下面是我的代码:
MainController:
module Health
class MainController < ApiController
before_action -> { verify_access_to_client(action: READ) }
before_action :verify_emp_index_access
def display
puts ‘Hi’
end
end
end
ApiController:
module Health
class ApiController < ApplicationController
include CloudServiceOauth::Rails::RequestAuthenticator
<some code>
end
end
ApplicationController:
module Health
class ApplicationController < ActionController::API
end
end
即使在gemspec文件中包含“ rails-api”,我仍然收到此错误。请帮助我解决此问题。