GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
Given a route like this:
namespace :foo, :constraints => DomainChecker::Foo do
Previously what one could do is stuff the module under /lib and load it in an initializer.
Right now it would seem that the initializers are not being ran before the route drawing, thus ending up in an undefined
I could not find anything about the change of behavior in the changelog, is this change made on purpose? Or a side-effect?
Between which versions has this changed?
The project was converted from 3.1.3 to 3.2
The issue seems to be that the routes are loaded before initializers are.
Adding my /lib to autoload paths seemed to fix it.
This is likely due to changes in the autoloader code. Maybe @josevalim knows. Anyway, why not just require the file you need? require should work fine inside routes.rb.
@tanelsuurhans If you are using active_reload please remove it form your project. See plataformatec/devise#1597 (comment)
@rafaelfranca Indeed I am (and I did have a gutfeeling it might be the thing affecting me). Thank you for the hint.
Just to be clear - this is also causing routes being loaded before any initializers are ran? Or is this a separate, intentional change in 3.2?
@tanelsuurhans @josevalim can explain better but yes, if active_reload is present in your project the routes will be loaded before any initializers and this is not intentional, is a side effect
I think that this issue can be closed