Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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"]
like image 345
Rubytastic Avatar asked Sep 19 '13 19:09

Rubytastic


2 Answers

You can use:

Rails.application.reload_routes!

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

like image 158
Richard Peck Avatar answered Oct 23 '22 22:10

Richard Peck


config.paths["config/routes.rb"] << YOUR_ROUTE_FILE
like image 26
Joe Van Dyk Avatar answered Oct 23 '22 23:10

Joe Van Dyk