Module: ActionDispatch::Routing::Mapper::TastefulResources
- Included in:
- ActionDispatch::Routing::Mapper
- Defined in:
- lib/tasteful_routes/mapper.rb
Defined Under Namespace
Classes: TastefulResource
Instance Method Summary collapse
Instance Method Details
#tasteful_resources(*resources, &block) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/tasteful_routes/mapper.rb', line 18 def tasteful_resources(*resources, &block) = resources. if apply_common_behavior_for(:tasteful_resources, resources, , &block) return self end resource_scope(:resource, TastefulResource.new(resources.pop, )) do yield if block_given? collection do get :index if parent_resource.actions.include?(:index) post :create if parent_resource.actions.include?(:create) end new do get :new end if parent_resource.actions.include?(:new) member do get :edit if parent_resource.actions.include?(:edit) get :show if parent_resource.actions.include?(:show) put :update if parent_resource.actions.include?(:update) delete :destroy if parent_resource.actions.include?(:destroy) end end self end |