Created
September 20, 2017 01:14
-
-
Save marksiemers/203385740c614d8e091332e30290bdd7 to your computer and use it in GitHub Desktop.
Example of nesting routes in rails
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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