Class: AdminCore::ResourceRouter

Inherits:
Object
  • Object
show all
Defined in:
lib/admin_core/resource_router.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(resource_manager_class) ⇒ ResourceRouter

Returns a new instance of ResourceRouter.

Parameters:

  • resource_manager_class (Class)


10
11
12
# File 'lib/admin_core/resource_router.rb', line 10

def initialize(resource_manager_class)
  @resource_manager_class = resource_manager_class
end

Class Method Details

.url_helpersObject



5
6
7
# File 'lib/admin_core/resource_router.rb', line 5

def self.url_helpers
  @url_helpers ||= Rails.application.routes.url_helpers
end

Instance Method Details

#edit_path(param) ⇒ String

Parameters:

  • param (String)

Returns:

  • (String)


32
33
34
# File 'lib/admin_core/resource_router.rb', line 32

def edit_path(param)
  url_for(controller: controller, action: 'edit', id: strip(param), only_path: true)
end

#index_pathString

Returns:

  • (String)


15
16
17
# File 'lib/admin_core/resource_router.rb', line 15

def index_path
  url_for(controller: controller, action: 'index', only_path: true)
end

#new_pathString

Returns:

  • (String)


20
21
22
# File 'lib/admin_core/resource_router.rb', line 20

def new_path
  url_for(controller: controller, action: 'new', only_path: true)
end

#show_path(param) ⇒ String

Parameters:

  • param (String, ActiveRecord::Base)

Returns:

  • (String)


26
27
28
# File 'lib/admin_core/resource_router.rb', line 26

def show_path(param)
  url_for(controller: controller, action: 'show', id: strip(param), only_path: true)
end