method

resource

Importance_0
v3.0.0 - Show latest stable - 0 notes - Class: ActionDispatch::Routing::Mapper::Resources
resource(*resources, &block) public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# 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
Register or log in to add new notes.