Closed fractaledmind closed 2 years ago
Which version of anyway_config / Rails / Puma do you use?
I tried to reproduce it here: https://github.com/anycable/anycable_rails_demo/tree/try/anyway_config_84 ; bundle exec puma
works fine.
anyway_config (2.1.0)
rails (6.1.3.2)
puma (5.3.2)
Is there any third-party gem using anyway_config? That could make it load before Rails (e.g., some puma plugin?).
The only way to check this is to add a breakpoint (or binding.pry
) to anyway_config/lib/anyway_config.rb
and see what calls it.
Closed as stale
At this line the Railtie is conditionally loaded depending on whether or not
::Rails::VERSION
is defined: https://github.com/palkan/anyway_config/blob/f474eaa77d0a342d47f960e40e70e1e6ac964f2e/lib/anyway_config.rb#L39However, when a Rails app used
bundle exec puma
to start its webserver instead ofbundle exec rails server
,::Rails
is not defined at the point that this code is called (in my case I have an/initializers/anyway_config.rb
file that is doing minimal configuration, like adding "staging" toknown_environments
. And I get this error:I have manually debugged and confirmed that the problem is that
::Rails
is not defined and that if I runrails server
it is defined.For now, I have worked around this by simply manually calling
require "anyway/rails"
in my initializer, but this doesn't feel right.