Here's an alternate way. No need to use extends or modularize your routes.
# config/application.rb module MyApp class Application < Rails::Application config.paths['config/routes.rb'].concat Dir[Rails.root.join("config/routes/*.rb")] end end
# config/routes.rb MyApp::Application.routes.draw do namespace :api do resources :users resources :projects resources :tasks end end
# config/routes/admin.rb MyApp::Application.routes.draw do namespace :admin do resources :users resources :projects resources :tasks end end
# config/routes/admin_api.rb MyApp::Application.routes.draw do namespace :admin do namespace :api do resources :users resources :projects resources :tasks end end
# config/routes/api.rb MyApp::Application.routes.draw do namespace :api do resources :users resources :projects resources :tasks end end
Thanks, used your way.
P.S. In previous project used the next receipt = mattboldt.com/separate-rails-route... but your style is more clean, imho.
Dude that's great! I will re-evaluate my approach knowing this. :)
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Here's an alternate way.
No need to use extends or modularize your routes.
Thanks, used your way.
P.S. In previous project used the next receipt = mattboldt.com/separate-rails-route... but your style is more clean, imho.
Dude that's great! I will re-evaluate my approach knowing this. :)