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_batch_action_path(params = {}, additional_params = {}) ⇒ Object


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

def route_batch_action_path(params = {}, additional_params = {})
  route_builder.batch_action_path(params, additional_params)
end

#route_builderObject


36
37
38
# File 'lib/active_admin/resource/routes.rb', line 36

def route_builder
  @route_builder ||= RouteBuilder.new(self)
end

#route_collection_path(params = {}, additional_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


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

def route_collection_path(params = {}, additional_params = {})
  route_builder.collection_path(params, additional_params)
end

#route_edit_instance_path(resource, additional_params = {}) ⇒ Object


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

def route_edit_instance_path(resource, additional_params = {})
  route_builder.member_action_path(:edit, resource, additional_params)
end

#route_instance_path(resource, additional_params = {}) ⇒ 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


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

def route_instance_path(resource, additional_params = {})
  route_builder.instance_path(resource, additional_params)
end

#route_member_action_path(action, resource, additional_params = {}) ⇒ Object


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

def route_member_action_path(action, resource, additional_params = {})
  route_builder.member_action_path(action, resource, additional_params)
end

#route_prefixObject

Returns the routes prefix for this config


32
33
34
# File 'lib/active_admin/resource/routes.rb', line 32

def route_prefix
  namespace.route_prefix
end

#route_uncountable?Boolean

Returns:

  • (Boolean)

40
41
42
43
44
# File 'lib/active_admin/resource/routes.rb', line 40

def route_uncountable?
  config = resources_configuration[:self]

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