Legacy rails app that's been upgraded to v6.0.5.1 - Zeitwerk enabled
I have a controller concern. I.e.
# /app/controllers/concerns/example.rb
module Example
extend ActiveSupport::Concern
CONSTANT = [1, 2, 3].freeze
end
and a model concern that works as followers
# /app/models/concerns/model/exampleable.rb
module Model::Exampleable
extend ActiveSupport::Concern
BUILD_ENUM = -> (arr) { arr.each_with_object({}).with_index { |(el, accu), index| accu.merge!({ el.to_sym => index }) } }.freeze
included do
enum random_enum: BUILD_ENUM[Example::CONSTANT]
end
end
in my application.rb
config.eager_load_paths += %W[
#{config.root}/app/models/concerns
#{config.root}/app/controllers/concerns
]
Everything works fine in development + testing. I've read over the Rails 6 Autoloading docs a few times. I cannot figure out what rules I am violating and why it is unable to find the other module. The error I am getting is:
app/models/concerns/model/exampleable.rb:8:in `block in <module:Exampleable>': uninitialized constant Example::CONSTANT (NameError)