Skip to content

Instantly share code, notes, and snippets.

@caike
Created January 31, 2014 16:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save caike/8735562 to your computer and use it in GitHub Desktop.
Save caike/8735562 to your computer and use it in GitHub Desktop.
Nice to have Route concern
BananaPodcast::Application.routes.draw do
class APIEndPoint
def self.call(mapper, options)
mapper.namespace :api, path: '/', constraints: { subdomain: 'api' }
end
end
concern :api, APIEndPoint
resources :zombies, concerns: :api
#
# instead of this:
#
# namespace :api, path: '/', constraints: { subdomain: 'api' } do
# resources :zombies
# end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment