lib/rest_framework/routers.rb
def rest_route(name=nil, **kwargs, &block)
      controller = kwargs.delete(:controller) || name
      route_root_to = kwargs.delete(:route_root_to)
      if controller.is_a?(Class)
        controller_class = controller
      else
        controller_class = self._get_controller_class(controller, pluralize: false)
      end

      # Set controller if it's not explicitly set.
      kwargs[:controller] = name unless kwargs[:controller]

      # Route actions using the resourceful router, but skip all builtin actions.
      actions = RESTFramework::Utils::parse_extra_actions(controller_class.extra_actions)
      public_send(:resource, name, only: [], **kwargs) do
        # Route a root for this resource.
        if route_root_to
          get '', action: route_root_to
        end

        self._route_extra_actions(actions, &block)
      end
    end
# Route a controller without the default resourceful paths.
Route a controller without the default resourceful paths.
Route a controller without the default resourceful paths .
def rest_route(name=nil, **kwargs, &block)
      controller = kwargs.delete(:controller) || name
      route_root_to = kwargs.delete(:route_root_to)
      if controller.is_a?(Class)
        controller_class = controller
      else
        controller_class = self._get_controller_class(controller, pluralize: false)
      end
      kwargs[:controller] = name unless kwargs[:controller]
      actions = RESTFramework::Utils::parse_extra_actions(controller_class.extra_actions)
      public_send(:resource, name, only: [], **kwargs) do
        if route_root_to
          get '', action: route_root_to
        end
        self._route_extra_actions(actions, &block)
      end
    end
def rest_route ( name = nil , ** kwargs , & block ) controller = kwargs . delete ( :controller ) || name route_root_to = kwargs . delete ( :route_root_to ) if controller . is_a? ( Class ) controller_class = controller else controller_class = self . _get_controller_class ( controller , pluralize : false ) end kwargs [ :controller ] = name unless kwargs [ :controller ] actions = RESTFramework :: Utils :: parse_extra_actions ( controller_class . extra_actions ) public_send ( :resource , name , only : [ ] , ** kwargs ) do if route_root_to get '' , action : route_root_to end self . _route_extra_actions ( actions , & block ) end end
Route a controller without the default resourceful paths.
Route a controller without the default resourceful paths .
# Set controller if it's not explicitly set. # Route actions using the resourceful router, but skip all builtin actions. # Route a root for this resource.
name
kwargs
block