无法自动加载常量

时间:2018-06-06 19:47:26

标签: ruby-on-rails ruby

在rails 5.2中我有一个小lib 在app / lib / itunes下(app / lib下的所有内容应该自动加载吗?)。 然而,当我启动sidekiq

时,我收到一个加载错误
    LoadError: Unable to autoload constant Itunes::ItunesClient, 
expected /app/lib/itunes/itunes_client.rb to define it
2018-06-06T19:38:49.560Z 46606 TID-ov5d572iq WARN: 
.rvm/gems/ruby-2.5.0/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:503:in `load_missing_constant'
.rvm/gems/ruby-2.5.0/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:193:in `const_missing'
/app/interactors/fetch_itunes_app_service.rb:4:in `call'



class FetchItunesAppService
  include Interactor
  def call
    @client = Itunes::ItunesClient.new
    ...
  end
end


#app/lib/itunes/itunes_client.rb    
class Itunes::ItunesClient < Itunes::ItunesBaseClient

...
end

#app/lib/itunes/itunes_base_client.rb
class Itunes::ItunesBaseClient
...
end

0 个答案:

没有答案