ruby on rails - Reload namespaced constant in initializer -
ran interesting scenario today i'm unsure how resolve.
given rails app initializer:
file: config/initializers/integrations.rb
integrations::configs = { "key" => "value" }.freeze
if go bundle exec rails console
, ask constant works expected:
integrations::configs => {"key"=> "value"}
then if use reload!
in console, lose constant:
[2] pry(main)> reload! reloading... => true [3] pry(main)> integrations::configs nameerror: uninitialized constant integrations::configs (pry):3:in `<main>'
if remove namespace , have configs
constant works , reloads expected. i've read through of reload!
documentation find , can tell isn't expected.
my question being, how can correctly use namespaced constant in initializer while still being able use reload!
?
Comments
Post a Comment