Module: ActionDispatch::Routing::Mapper::Resources

Defined in:
lib/active_scaffold/extensions/routing_mapper.rb

Instance Method Summary collapse

Instance Method Details

#as_nested_resources(*resources) ⇒ Object


77
78
79
80
81
82
83
# File 'lib/active_scaffold/extensions/routing_mapper.rb', line 77

def as_nested_resources(*resources)
  options = resources.extract_options!
  nested_options = options.merge(parent_scaffold: parent_scaffold)
  resources.each do |resource|
    resources(resource, nested_options.merge(association: resource)) { yield if block_given? }
  end
end

#as_scoped_routes(*scopes) ⇒ Object


85
86
87
88
89
90
91
# File 'lib/active_scaffold/extensions/routing_mapper.rb', line 85

def as_scoped_routes(*scopes)
  options = scopes.extract_options!
  scoped_options = options.merge(parent_scaffold: parent_scaffold, association: parent_resource.plural)
  scopes.each do |scope|
    resources(scope, scoped_options.merge(named_scope: scope)) { yield if block_given? }
  end
end

#parent_scaffoldObject


93
94
95
# File 'lib/active_scaffold/extensions/routing_mapper.rb', line 93

def parent_scaffold
  merge_module_scope(@scope[:module], parent_resource.plural)
end