Skip to content

Instantly share code, notes, and snippets.

@thedrewbisset
Created November 20, 2017 19:09
Show Gist options
  • Save thedrewbisset/7637ef8ef7a1c8a7e22fc5b950f8c136 to your computer and use it in GitHub Desktop.
Save thedrewbisset/7637ef8ef7a1c8a7e22fc5b950f8c136 to your computer and use it in GitHub Desktop.
SmallThings::Application.routes.draw do
namespace :core do
resources :things, param: :name, only: [:create, :show] do
member do
resource :component, only: :create, module: :things, as: :things_component
end
end
end
end
# Produces routing and file-pathing that match 1:1 and set things up well for containing resource complexity within
# components that are colocated within a parent module type:
#
# core_things POST /core/things core/things#create
# core_things GET /core/things/:name core/things#show
# core_things_component POST /core/things/:name/component core/things/components#create
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment