method
resource
v3.0.0 -
Show latest stable
- Class:
ActionDispatch::Routing::Mapper::Resources
resource(*resources, &block)public
No documentation available.
# File actionpack/lib/action_dispatch/routing/mapper.rb, line 552
def resource(*resources, &block)
options = resources.extract_options!
if apply_common_behavior_for(:resource, resources, options, &block)
return self
end
resource_scope(SingletonResource.new(resources.pop, options)) do
yield if block_given?
collection_scope do
post :create
end if parent_resource.actions.include?(:create)
new_scope do
get :new
end if parent_resource.actions.include?(:new)
member_scope 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