Skip to content

Instantly share code, notes, and snippets.

@Systho
Last active March 28, 2017 09:31
Show Gist options
  • Save Systho/37ed59e66706be5d834e to your computer and use it in GitHub Desktop.
Save Systho/37ed59e66706be5d834e to your computer and use it in GitHub Desktop.
routing concern on collection
Rails.application.routes.draw do
concern :archivable do
scope module: parent_resource.plural do
resources :archiving, only: [:create, :destroy]
end
end
resources :clients , concerns: [ :archivable ]
resources :coaches , concerns: [ :archivable ]
end
end
client_archiving_index POST /clients/:client_id/archiving(.:format) front/clients/archiving#create
client_archiving DELETE /clients/:client_id/archiving/:id(.:format) front/clients/archiving#destroy
...
coach_archiving_index POST /coaches/:coach_id/archiving(.:format) front/coaches/archiving#create
coach_archiving DELETE /coaches/:coach_id/archiving/:id(.:format) front/coaches/archiving#destroy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment