3

load_missing_constant使用关注点时出现错误。只有当我开始 rake 任务时。Rails 服务器/控制台正常启动。

# app/models/journey.rb
class Journey < CouchRest::Model::Base
  include Searchable
end

# app/models/concerns/journey/payable.rb
module Journey::Payable
  extend ActiveSupport::Concern

  module ClassMethods
    def search
      true
    end
  end
end

#application.rb
config.autoload_paths += %W( #{config.root}/lib #{config.root}/app/models/concerns )

错误

/Users/user/.rvm/gems/ruby-1.9.3-p194@project/gems/activesupport-3.1.8/lib/active_support/dependencies.rb:490:in `load_missing_constant': 预期 /Users/user/code /project/app/models/concerns/journey/payable.rb 定义 Journey::Payable (LoadError)

4

0 回答 0