Skip to content

Instantly share code, notes, and snippets.

@marksiemers
Created September 20, 2017 01:14
Show Gist options
  • Save marksiemers/203385740c614d8e091332e30290bdd7 to your computer and use it in GitHub Desktop.
Save marksiemers/203385740c614d8e091332e30290bdd7 to your computer and use it in GitHub Desktop.
Example of nesting routes in rails
Rails.application.routes.draw do
concern :reviewable do
resources :reviews, only: [:new, :create, :index]
end
resources :reviews, only: [:show, :delete, :edit, :update]
resources :artists, :albums, :songs, :lyrics, only: [], concerns: :reviewable
resources :artists do
resources :albums, shallow: true do
resources :songs, shallow: true do
resources :lyrics, shallow: true
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment