Class: Administrate::ResourceResolver

Inherits:
Object
  • Object
show all
Defined in:
lib/administrate/resource_resolver.rb

Instance Method Summary collapse

Constructor Details

#initialize(controller_path) ⇒ ResourceResolver

Returns a new instance of ResourceResolver.



3
4
5
# File 'lib/administrate/resource_resolver.rb', line 3

def initialize(controller_path)
  @controller_path = controller_path
end

Instance Method Details

#dashboard_classObject



7
8
9
# File 'lib/administrate/resource_resolver.rb', line 7

def dashboard_class
  ActiveSupport::Inflector.constantize("#{resource_class_name}Dashboard")
end

#namespaceObject



11
12
13
# File 'lib/administrate/resource_resolver.rb', line 11

def namespace
  controller_path.split("/").first.to_sym
end

#resource_classObject



15
16
17
# File 'lib/administrate/resource_resolver.rb', line 15

def resource_class
  ActiveSupport::Inflector.constantize(resource_class_name)
end

#resource_nameObject



19
20
21
# File 'lib/administrate/resource_resolver.rb', line 19

def resource_name
  model_path_parts.map(&:underscore).join("__").to_sym
end

#resource_titleObject



23
24
25
# File 'lib/administrate/resource_resolver.rb', line 23

def resource_title
  resource_class.model_name.human
end