Rails : putting CONSTANT in environment.rb - needs to be before Rails::Initializer.run for routes.rb to see it

by Derek Sivers

I'm creating a CONSTANT value that I want my whole Rails app to see.

I put it in config/environment.rb, down at the bottom, just like it tells me to.
("# Include your application configuration below")

But - I wanted to access that CONSTANT from config/routes.rb

No luck. Wouldn't see it. Very confused.

I moved the definition of that CONSTANT up at the top - before the Rails::Initializer.run line

Now it works.