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

Popular posts from this blog

iis - ASP.Net Core CreatedAtAction in HttpPost action returns 201 but entire request ends with 500 -

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -