This question already has an answer here:
- Splitting Routes File Into Multiple Files 4 answers
I have huge routes.rb file and I want to split into multiple manageable files.
As suggested in following article, I have created separated folder for routes and I have created multiple routes files in this folder Link: http://rails-bestpractices.com/posts/73-split-route-namespaces-into-different-files
routes.rb
routes/user.rb
routes/manager.rb
routes/admin.rb
routes/anonymous.rb
and in my application.rb, I set the config.paths value. I used various possible combination but I am still unable to load all secondary routes files.
Here are the list of code I used to set config.paths in application.rb file. None are working for me.
config.paths["config/routes"].concat(Dir[Rails.root.join("config/routes/*.rb")])
config.paths["config/routes"] = Dir[Rails.root.join("config/routes/*.rb")]
config.paths["config/routes"] = Dir[Rails.root.join("config/routes/*.rb")].each{|r| config.paths["config/routes"].unshift(r) }
config.paths.config.routes.concat Dir[Rails.root.join("config/routes/*.rb")]
Appreciate if someone can help me. Please note that I am using Rails 3.2.1. I am sure that above techniques of splitting routes will work with previous version of Rails but I am unable to implement using 3.2.1.