Last active
August 29, 2015 14:19
-
-
Save oojikoo-gist/db6c3279316502f6d019 to your computer and use it in GitHub Desktop.
rails: routes concerns
This file contains 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
# examples of rails 4 routes concerns | |
concern :commentable do | |
resources :comments | |
end | |
concern :image_attachable do | |
resources :images, only: :index | |
end | |
resources :messages, concerns: :commentable | |
resources :posts, concerns: [:commentable, :image_attachable] | |
concern :printable do | |
member do | |
post :print | |
end | |
end | |
resources :pamphlets, concerns: :printable | |
resources :posters, concerns: :printable do | |
collection do | |
post :bulk_print | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment