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”

Parameters:

  • params (Hash) (defaults to: {})

    of params: { study_id: 3 }

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_edit_instance_path(resource) ⇒ Object


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

def route_edit_instance_path(resource)
  RouteBuilder.new(self).edit_instance_path(resource)
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


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

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

#route_uncountable?Boolean

Returns:

  • (Boolean)

27
28
29
30
31
# File 'lib/active_admin/resource/routes.rb', line 27

def route_uncountable?
  config = resources_configuration[:self]

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