how to reload routes /config/routes/* in rails 4?

Rubytastic picture Rubytastic · Sep 19, 2013 · Viewed 8.6k times · Source

How to force rails 4 to reload all route files?
That is without having to restart the application to make the routes from /config/routes/.rb get loaded* I did a split them up in /config/routes/.rb but these /config/routes/ files are not reloaded.

This worked in rails 3 but not 4:

#config.paths['config/routes'].unshift *Dir["config/routes/*.rb"]

Answer

Richard Peck picture Richard Peck · Feb 27, 2014

You can use:

Rails.application.reload_routes!

You can read about it here (will have to use find)