module ActionDispatch::Routing::Mapper::Resources

Public Instance Methods

as_association_routes() click to toggle source
# File lib/active_scaffold/extensions/routing_mapper.rb, line 43
def as_association_routes
  resource_scope(:resource, ActiveScaffoldAssociation.new(parent_resource.name, parent_resource.options)) do
    collection do
      ActionDispatch::Routing::ACTIVE_SCAFFOLD_ASSOCIATION_ROUTING[:collection].each do |name, type|
        match(name, :via => type) if parent_resource.actions.include? name
      end
    end
    member do
      ActionDispatch::Routing::ACTIVE_SCAFFOLD_ASSOCIATION_ROUTING[:member].each do |name, type|
        match(name, :via => type) if parent_resource.actions.include? name
      end
    end
  end
end
as_nested_resources(*resources) { || ... } click to toggle source
# File lib/active_scaffold/extensions/routing_mapper.rb, line 58
def as_nested_resources(*resources)
  options = resources.extract_options!
  resources.each do |resource|
    resources(resource, options.merge(:parent_scaffold => merge_module_scope(@scope[:module], parent_resource.plural), :association => resource)) { yield if block_given? }
  end
end
as_routes(opts = {:association => true}) click to toggle source
# File lib/active_scaffold/extensions/routing_mapper.rb, line 25
def as_routes(opts = {:association => true})
  resource = parent_resource
  resource_scope(:resource, ActiveScaffold.new(parent_resource.name, parent_resource.options)) do
    collection do
      ActionDispatch::Routing::ACTIVE_SCAFFOLD_CORE_ROUTING[:collection].each do |name, type|
        match(name, :via => type) if parent_resource.actions.include? name
      end
    end
    member do
      ActionDispatch::Routing::ACTIVE_SCAFFOLD_CORE_ROUTING[:member].each do |name, type|
        match(name, :via => type) if parent_resource.actions.include? name
      end
      get 'list', :action => :index if resource.actions.include? :index
    end
  end
  as_association_routes if opts[:association]
end
as_scoped_routes(*scopes) { || ... } click to toggle source
# File lib/active_scaffold/extensions/routing_mapper.rb, line 65
def as_scoped_routes(*scopes)
  options = scopes.extract_options!
  scopes.each do |scope|
    resources(scope, options.merge(:parent_scaffold => merge_module_scope(@scope[:module], parent_resource.plural), :named_scope => scope, :controller => parent_resource.plural)) { yield if block_given? }
  end
end