我正在使用 Goliath 为我的 Rails 应用程序编写 Web 服务,我想记录发送到我的 Web 服务器的所有请求。我有这个Api
类,它位于两个模块中:
require 'goliath'
module WebService
module Rest
class Api < Goliath::API
def response(env)
# Log the request
Logger.create(id: params['id'], type: params['type'])
[200, {}, "success"]
end
end
end
我有一个app/models
名为的模型Logger
。问题是当我运行ruby api.rb -sv
它时会引发错误:
uninitialized constant WebService::Rest::Api::Logger
我应该怎么办?谢谢。