Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upInitializers and react-rails gem placement in Gemfile suspect load order issue with `after: :load_config_initializers` option #1033
Comments
Sounds like an interesting discovery. It could be good to see how other popular rails gems tie in and change to modern good practice just as a matter of course, especially if we do end up showing this is causing an issue. |
I'm sorry to post an issue that is missing crucial evidence, but some debugging of a recent config loading bug makes me suspect that the react-rails
railtie.rb
may be modifying the load order of initializers, and preventing the values inRails.application.config
being as expected.Whether this happens or not appears to be partly dependent on where in the
Gemfile
thereact-rails
gem is loaded. Placingreact-rails
at the very end of theGemfile
seems to help.One suspect for changing the load order of initializers is the use of the
after: :load_config_initializers
option throughout react-rails'railtie.rb
.I couldn't find an explanation for this however Rails has removed one use of the
after: :load_config_initializers
option from its ownactive_support/railtie.rb
with this comment:Some testing of commenting out the
after: :load_config_initializers
options in the react-railsrailtie.rb
did seem to alleviate the load order issue I was seeing when loading thereact-rails
gem.I've not been able to get to the bottom of this yet I'm afraid, so I'm posting this here in the hope that other developers will encounter this, add their experience, and help resolve.