我有一个如下所示的目录结构:
\- app
\- models
\- services
\- recommended_action
|- base.rb
|- other_recommended_action.rb
|- random_service.rb
在我的application.rb中,我通过
自动加载recommended_action目录config.autoload_paths += %W(
#{config.root}/app/services/recommended_action
)
我的base.rb
文件如下所示:
module RecommendedAction
class Base
def initialize(attributes = {})
# assign the attributes
end
end
end
但是,每当我尝试加载rails控制台时,我都会收到以下错误:
Unable to autoload constant Base, expected /Users/justin/project/app/services/recommended_action/base.rb to define it (LoadError)
我错过了什么?