class ActiveScaffold::Routing::Basic

Public Class Methods

new(defaults = {}) click to toggle source
# File lib/active_scaffold/extensions/routing_mapper.rb, line 46
def initialize(defaults = {})
  @defaults = defaults
end

Public Instance Methods

call(mapper, options = {}) click to toggle source
# File lib/active_scaffold/extensions/routing_mapper.rb, line 50
def call(mapper, options = {})
  options = @defaults.merge(options)
  actions = get_actions(ACTIVE_SCAFFOLD_CORE_ROUTING, options)

  mapper.collection do
    ActiveScaffold::Routing::ACTIVE_SCAFFOLD_CORE_ROUTING[:collection].each do |name, type|
      mapper.match(name, via: type) if actions.include? name
    end
  end

  mapper.member do
    ActiveScaffold::Routing::ACTIVE_SCAFFOLD_CORE_ROUTING[:member].each do |name, type|
      mapper.match(name, via: type) if actions.include? name
    end
    mapper.get 'list', action: :index if mapper.send(:parent_resource).actions.include? :index
  end

  super if options[:association]
end