Break up large routing files in Rails
Breaking apart a routing file could be useful if you have large a different concepts in your app with their own larger route sets.
To do this you can utilize draw
# config/routes.rb
Rails.application.routes.draw do
get 'foo', to: 'foo#bar'
draw(:admin)
end
This will try to load another route file at config/routes/admin.rb
. That file is just another normal routing file.
# config/routes/admin.rb
namespace :admin do
resources :users
end
Tweet