Class: ActiveScaffold::Routing::Basic
- Inherits:
-
Association
- Object
- Association
- ActiveScaffold::Routing::Basic
- Defined in:
- lib/active_scaffold/extensions/routing_mapper.rb
Instance Method Summary collapse
- #call(mapper, options = {}) ⇒ Object
-
#initialize(defaults = {}) ⇒ Basic
constructor
A new instance of Basic.
Methods inherited from Association
#default_actions, #get_actions
Constructor Details
#initialize(defaults = {}) ⇒ Basic
Returns a new instance of Basic.
46 47 48 |
# File 'lib/active_scaffold/extensions/routing_mapper.rb', line 46 def initialize(defaults = {}) @defaults = defaults end |
Instance Method Details
#call(mapper, options = {}) ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/active_scaffold/extensions/routing_mapper.rb', line 50 def call(mapper, = {}) = @defaults.merge() actions = get_actions(ACTIVE_SCAFFOLD_CORE_ROUTING, ) 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 [:association] end |