I'm having issues with zeitwerk where I can't access another models constant that shares the same name. For example:
in /app/models
I have a worker.rb
file with a constant RETRY_COUNT
class Worker < ApplicationRecord
RETRY_COUNT = 10
end
and in /lib
I have a /critical/worker.rb
file but namespaced under critical
module Critical
class Worker
some_method(::Worker::RETRY_COUNT)
end
end
I'm able to call the worker model class using ::Worker
, but when I call ::RETRY_COUNT
, it results in
NameError: uninitialized constant Worker (call 'Worker.connection' to establish a connection)::RETRY_COUNT
Anyway around this? I could just hardcode the RETRY_COUNT
on the Critical::Worker
class but I'd like to avoid doing that.