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



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

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



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

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



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

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