当我开始编写我的第一个railsapi时,我把所有API代码都放在了下面
app/core/api
config.autoload_paths += %W[
#{config.root}/lib
#{config.root}/app/core]
之后,我决定将API类移到app文件夹中。现在,当我运行我的测试,我得到了这个错误
Failure/Error: authenticate = API::AuthenticateFromToken.(params[:auth_token])
LoadError:
Unable to autoload constant AuthenticateFromToken, expected ./app/api/authenticate_from_token.rb to define it
module API
class AuthenticateFromToken
prepend SimpleCommand
def initialize(auth_token)
@auth_token = auth_token
end
def call
# authenticate code
end
end
end
api
app/core
到
app
我在自动加载方面没有任何问题。这个代码出了什么问题?