Routing Concerns allow you to declare common routes that can be reused inside others resources and routes.
concern :commentable do resources :comments end concern :image_attachable do resources :images, only: :index end
These concerns are used in Resources routing:
resources :messages, concerns: [:commentable, :image_attachable]
or in a scope or namespace:
namespace :posts do concerns :commentable end