使用层次结构/模块加载错误

时间:2014-11-07 21:48:23

标签: ruby-on-rails ruby

我有一个如下所示的目录结构:

\- 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)

我错过了什么?

0 个答案:

没有答案