При запуске моего приложения rails в Ubuntu (через любой процесс, например консоль, сервер, задачи rake и т. Д.) Я получаю неинициализированную постоянную ошибку из своих драгоценных камней.Тем не менее, я могу клонировать точно такой же репо на OSX, и это работает.Я показываю ошибку, исходящую из квартиры, но если я удаляю ссылки на Core :: Organization, проблема просто распространяется на следующий загруженный гем.Поэтому я полагаю, что это как-то связано с загрузкой драгоценных камней до констант из приложения.
Я пробовал загружать с использованием
config.eager_load = true
config.enable_dependency_loading = true
, но это ничего не изменило.
ОБНОВЛЕНИЕ: Я обнаружил, что замена "Core :: Organization" на просто "Organization" делает его работоспособным.Так что это как-то связано с пространством имен.В базовом каталоге находится модуль core.rb:
module Core
def self.table_name_prefix
'core_'
end
end
Environment:
- Ubuntu 18.04
- Ruby 2.5.0
- Rails 5.2.2
Пример трассировки ошибок:
/var/lib/gems/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:74:in `block in load_missing_constant': uninitialized constant Core::Organisation (NameError)
from /var/lib/gems/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:8:in `without_bootsnap_cache'
from /var/lib/gems/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:74:in `rescue in load_missing_constant'
from /var/lib/gems/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:56:in `load_missing_constant'
from /var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/inflector/methods.rb:285:in `const_get'
from /var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/inflector/methods.rb:285:in `block in constantize'
from /var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/inflector/methods.rb:281:in `each'
from /var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/inflector/methods.rb:281:in `inject'
from /var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/inflector/methods.rb:281:in `constantize'
from /var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/core_ext/string/inflections.rb:68:in `constantize'
from /var/lib/gems/2.5.0/gems/apartment-2.2.0/lib/apartment/adapters/postgresql_adapter.rb:50:in `process_excluded_model'
from /var/lib/gems/2.5.0/gems/apartment-2.2.0/lib/apartment/adapters/abstract_adapter.rb:105:in `block in process_excluded_models'
from /var/lib/gems/2.5.0/gems/apartment-2.2.0/lib/apartment/adapters/abstract_adapter.rb:104:in `each'
from /var/lib/gems/2.5.0/gems/apartment-2.2.0/lib/apartment/adapters/abstract_adapter.rb:104:in `process_excluded_models'
from /var/lib/gems/2.5.0/gems/apartment-2.2.0/lib/apartment/tenant.rb:18:in `init'
from /var/lib/gems/2.5.0/gems/apartment-2.2.0/lib/apartment/railtie.rb:34:in `block (2 levels) in <class:Railtie>'
from /var/lib/gems/2.5.0/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:416:in `with_connection'
from /var/lib/gems/2.5.0/gems/apartment-2.2.0/lib/apartment/railtie.rb:33:in `block in <class:Railtie>'
from /var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/callbacks.rb:426:in `instance_exec'
from /var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/callbacks.rb:426:in `block in make_lambda'
from /var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/callbacks.rb:198:in `block (2 levels) in halting'
from /var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/callbacks.rb:606:in `block (2 levels) in default_terminator'
from /var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/callbacks.rb:605:in `catch'
from /var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/callbacks.rb:605:in `block in default_terminator'
from /var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/callbacks.rb:199:in `block in halting'
from /var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/callbacks.rb:513:in `block in invoke_before'
from /var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/callbacks.rb:513:in `each'
from /var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/callbacks.rb:513:in `invoke_before'
from /var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/callbacks.rb:131:in `run_callbacks'
from /var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/reloader.rb:89:in `prepare!'
from /var/lib/gems/2.5.0/gems/railties-5.2.2/lib/rails/application/finisher.rb:63:in `block in <module:Finisher>'
from /var/lib/gems/2.5.0/gems/railties-5.2.2/lib/rails/initializable.rb:32:in `instance_exec'
from /var/lib/gems/2.5.0/gems/railties-5.2.2/lib/rails/initializable.rb:32:in `run'
from /var/lib/gems/2.5.0/gems/railties-5.2.2/lib/rails/initializable.rb:61:in `block in run_initializers'
from /usr/lib/ruby/2.5.0/tsort.rb:228:in `block in tsort_each'
from /usr/lib/ruby/2.5.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
from /usr/lib/ruby/2.5.0/tsort.rb:431:in `each_strongly_connected_component_from'
from /usr/lib/ruby/2.5.0/tsort.rb:349:in `block in each_strongly_connected_component'
from /usr/lib/ruby/2.5.0/tsort.rb:347:in `each'
from /usr/lib/ruby/2.5.0/tsort.rb:347:in `call'
from /usr/lib/ruby/2.5.0/tsort.rb:347:in `each_strongly_connected_component'
from /usr/lib/ruby/2.5.0/tsort.rb:226:in `tsort_each'
from /usr/lib/ruby/2.5.0/tsort.rb:205:in `tsort_each'
from /var/lib/gems/2.5.0/gems/railties-5.2.2/lib/rails/initializable.rb:60:in `run_initializers'
from /var/lib/gems/2.5.0/gems/railties-5.2.2/lib/rails/application.rb:361:in `initialize!'
from /home/sellsmartadmin/Sellsmart/config/environment.rb:5:in `<main>'
from /var/lib/gems/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
from /var/lib/gems/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
from /var/lib/gems/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
from /var/lib/gems/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
from /var/lib/gems/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
from /var/lib/gems/2.5.0/gems/spring-2.0.2/lib/spring/application.rb:102:in `preload'
from /var/lib/gems/2.5.0/gems/spring-2.0.2/lib/spring/application.rb:153:in `serve'
from /var/lib/gems/2.5.0/gems/spring-2.0.2/lib/spring/application.rb:141:in `block in run'
from /var/lib/gems/2.5.0/gems/spring-2.0.2/lib/spring/application.rb:135:in `loop'
from /var/lib/gems/2.5.0/gems/spring-2.0.2/lib/spring/application.rb:135:in `run'
from /var/lib/gems/2.5.0/gems/spring-2.0.2/lib/spring/application/boot.rb:19:in `<top (required)>'
from /usr/local/lib/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /usr/local/lib/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from -e:1:in `<main>'
Заранее благодарен за любую помощь, которую кто-либо может предложить!