部署后,我在 Heroku 上收到此错误,但我没有收到错误或在本地遇到此问题。
以下命名/命名空间等有什么问题?我错过了什么?
模型/关注/购买/finalize_utils.rb
module Purchase::FinalizeUtils
extend ActiveSupport::Concern
end
模型/购买.rb
class Purchase < ActiveRecord::Base
include FinalizeUtils
end
日志错误:
2017-01-26T22:39:25.553902+00:00 app[web.1]: RuntimeError: Circular dependency detected while autoloading constant Purchase::FinalizeUtils
2017-01-26T22:39:25.553903+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:492:in `load_missing_constant'
2017-01-26T22:39:25.553903+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:184:in `const_missing'
2017-01-26T22:39:25.553904+00:00 app[web.1]: /app/app/models/purchase.rb:19:in `<class:Purchase>'
2017-01-26T22:39:25.553904+00:00 app[web.1]: /app/app/models/purchase.rb:16:in `<top (required)>'
2017-01-26T22:39:25.553905+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:274:in `require'
2017-01-26T22:39:25.553906+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:274:in `block in require'
2017-01-26T22:39:25.553906+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:240:in `load_dependency'
2017-01-26T22:39:25.553907+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:274:in `require'
2017-01-26T22:39:25.553907+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:360:in `require_or_load'
2017-01-26T22:39:25.553907+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:494:in `load_missing_constant'
2017-01-26T22:39:25.553908+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:184:in `const_missing'
2017-01-26T22:39:25.553909+00:00 app[web.1]: /app/app/models/concerns/purchase/finalize_utils.rb:1:in `<top (required)>'
2017-01-26T22:39:25.553909+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:274:in `require'
2017-01-26T22:39:25.553909+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:274:in `block in require'
2017-01-26T22:39:25.553910+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:240:in `load_dependency'
2017-01-26T22:39:25.553910+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:274:in `require'
2017-01-26T22:39:25.553910+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:360:in `require_or_load'
2017-01-26T22:39:25.553911+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:317:in `depend_on'
2017-01-26T22:39:25.553912+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/railties-4.2.5.1/lib/rails/engine.rb:472:in `block (2 levels) in eager_load!'
2017-01-26T22:39:25.553911+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:233:in `require_dependency'
2017-01-26T22:39:25.553912+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/railties-4.2.5.1/lib/rails/engine.rb:471:in `each'
2017-01-26T22:39:25.553912+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/railties-4.2.5.1/lib/rails/engine.rb:471:in `block in eager_load!'
2017-01-26T22:39:25.553913+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/railties-4.2.5.1/lib/rails/engine.rb:469:in `each'
2017-01-26T22:39:25.553913+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/railties-4.2.5.1/lib/rails/engine.rb:469:in `eager_load!'
2017-01-26T22:39:25.553914+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/railties-4.2.5.1/lib/rails/engine.rb:346:in `eager_load!'
2017-01-26T22:39:25.553914+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/railties-4.2.5.1/lib/rails/application/finisher.rb:56:in `each'
2017-01-26T22:39:25.553914+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/railties-4.2.5.1/lib/rails/application/finisher.rb:56:in `block in <module:Finisher>'
2017-01-26T22:39:25.553915+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/railties-4.2.5.1/lib/rails/initializable.rb:30:in `instance_exec'
2017-01-26T22:39:25.553915+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/railties-4.2.5.1/lib/rails/initializable.rb:30:in `run'
2017-01-26T22:39:25.553915+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/railties-4.2.5.1/lib/rails/initializable.rb:55:in `block in run_initializers'
2017-01-26T22:39:25.553916+00:00 app[web.1]: /app/vendor/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:228:in `block in tsort_each'
2017-01-26T22:39:25.553916+00:00 app[web.1]: /app/vendor/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
2017-01-26T22:39:25.553917+00:00 app[web.1]: /app/vendor/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:431:in `each_strongly_connected_component_from'
2017-01-26T22:39:25.553917+00:00 app[web.1]: /app/vendor/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:349:in `block in each_strongly_connected_component'
2017-01-26T22:39:25.553917+00:00 app[web.1]: /app/vendor/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:347:in `each'
2017-01-26T22:39:25.553918+00:00 app[web.1]: /app/vendor/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:347:in `call'
2017-01-26T22:39:25.553918+00:00 app[web.1]: /app/vendor/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:347:in `each_strongly_connected_component'
2017-01-26T22:39:25.553918+00:00 app[web.1]: /app/vendor/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:226:in `tsort_each'
2017-01-26T22:39:25.553919+00:00 app[web.1]: /app/vendor/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:205:in `tsort_each'
2017-01-26T22:39:25.553921+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/railties-4.2.5.1/lib/rails/initializable.rb:54:in `run_initializers'
2017-01-26T22:39:25.553921+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/railties-4.2.5.1/lib/rails/application.rb:352:in `initialize!'
2017-01-26T22:39:25.553922+00:00 app[web.1]: /app/config/environment.rb:11:in `<top (required)>'