Clean up Rails Routes Is there any way I can DRY up this Rails 4 routes.rb code?

  match '/oauth/apps/' =&gt; 'oauth/applications#index', :as =&gt; :oauth_applications, :via =&gt; :get
  match '/oauth/apps/new/' =&gt; 'oauth/applications#new', :as =&gt; :new_oauth_application, :via =&gt; :get
  match '/oauth/apps/new/' =&gt; 'oauth/applications#create', :via =&gt; :post
  match '/oauth/apps/:id/' =&gt; 'oauth/applications#show', :as =&gt; :oauth_application, :via =&gt; :get
  match '/oauth/apps/:id/edit/' =&gt; 'oauth/applications#edit', :as =&gt; :edit_oauth_application, :via =&gt; :get
  match '/oauth/apps/:id/edit/' =&gt; 'oauth/applications#update', :via =&gt; :post
  match '/oauth/apps/:id/destroy/' =&gt; 'oauth/applications#destroy', :as =&gt; :destroy_oauth_application, :via =&gt; :delete
Yes, use namespace and resources:

namespace :oauth do
  resources :apps, controller: "applications", as: :applications
end


This is not 100% identical (the names of some of your routes have changed) but it is the way you should be building your routes, and you should change the rest of your app to reflect the change.

The primary difference is your names for the create and destroy routes have gone away; these routes shouldn't have names anyways. When you want to create/destroy a model, you should be using oath_applications_path, with  method: :post or method: :delete, not oath_apps_new_path/destroy_oauth_application_path.

My way also uses the correct verb (PUT) for updates.

Your rake routes:

       oauth_applications GET    /oauth/apps(.:format)             oauth/applications#index
    new_oauth_application GET    /oauth/apps/new(.:format)         oauth/applications#new
           oauth_apps_new POST   /oauth/apps/new(.:format)         oauth/applications#create
        oauth_application GET    /oauth/apps/:id(.:format)         oauth/applications#show
   edit_oauth_application GET    /oauth/apps/:id/edit(.:format)    oauth/applications#edit
                          POST   /oauth/apps/:id/edit(.:format)    oauth/applications#update
destroy_oauth_application DELETE /oauth/apps/:id/destroy(.:format) oauth/applications#destroy


My rake routes (reordered to match yours):

    oauth_applications GET    /oauth/apps(.:format)          oauth/applications#index
 new_oauth_application GET    /oauth/apps/new(.:format)      oauth/applications#new
                       POST   /oauth/apps(.:format)          oauth/applications#create
     oauth_application GET    /oauth/apps/:id(.:format)      oauth/applications#show
edit_oauth_application GET    /oauth/apps/:id/edit(.:format) oauth/applications#edit
                       PUT    /oauth/apps/:id(.:format)      oauth/applications#update
                       DELETE /oauth/apps/:id(.:format)      oauth/applications#destroy