Module: ActiveAdmin::Resource::Routes

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

Defined Under Namespace

Classes: RouteBuilder

Instance Method Summary collapse

Instance Method Details

#route_collection_path(params = {}) ⇒ String

Returns the path to this resource collection page.

Examples:

“/admin/posts”

Returns:

  • (String)

    the path to this resource collection page



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

def route_collection_path(params = {})
  RouteBuilder.new(self).collection_path(params)
end

#route_instance_path(resource) ⇒ String

Returns the path to this resource collection page.

Examples:

“/admin/posts/1”

Parameters:

  • resource (ActiveRecord::Base)

    the instance we want the path of

Returns:

  • (String)

    the path to this resource collection page



14
15
16
# File 'lib/active_admin/resource/routes.rb', line 14

def route_instance_path(resource)
  RouteBuilder.new(self).instance_path(resource)
end

#route_prefixObject

Returns the routes prefix for this config



19
20
21
# File 'lib/active_admin/resource/routes.rb', line 19

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

#route_uncountable?Boolean

Returns:

  • (Boolean)


23
24
25
26
27
# File 'lib/active_admin/resource/routes.rb', line 23

def route_uncountable?
  config = controller.resources_configuration[:self]

  config[:route_collection_name] == config[:route_instance_name]
end