Module: ActiveAdmin::Resource::Controllers

Included in:
Page, ActiveAdmin::Resource
Defined in:
lib/active_admin/resource/controllers.rb

Instance Method Summary collapse

Instance Method Details

#controllerObject

Returns the controller for this config



12
13
14
# File 'lib/active_admin/resource/controllers.rb', line 12

def controller
  @controller ||= controller_name.constantize
end

#controller_nameObject

Returns a properly formatted controller name for this config within its namespace



7
8
9
# File 'lib/active_admin/resource/controllers.rb', line 7

def controller_name
  [namespace.module_name, plural_camelized_resource_name + "Controller"].compact.join('::')
end

#route_collection_pathObject

Returns a symbol for the route to use to get to the collection of this resource



23
24
25
26
27
28
29
30
31
# File 'lib/active_admin/resource/controllers.rb', line 23

def route_collection_path
  route = [
    route_prefix, 
    controller.resources_configuration[:self][:route_collection_name], 
    'path'
  ]

  route.compact.join('_').to_sym
end

#route_prefixObject

Returns the routes prefix for this config



17
18
19
# File 'lib/active_admin/resource/controllers.rb', line 17

def route_prefix
  namespace.module_name.try(:underscore)
end