class Administrate::ResourceResolver
Attributes
controller_path[R]
Public Class Methods
new(controller_path)
click to toggle source
# File lib/administrate/resource_resolver.rb, line 3 def initialize(controller_path) @controller_path = controller_path end
Public Instance Methods
dashboard_class()
click to toggle source
# File lib/administrate/resource_resolver.rb, line 7 def dashboard_class ActiveSupport::Inflector.constantize("#{resource_class_name}Dashboard") end
namespace()
click to toggle source
# File lib/administrate/resource_resolver.rb, line 11 def namespace controller_path.split("/").first.to_sym end
resource_class()
click to toggle source
# File lib/administrate/resource_resolver.rb, line 15 def resource_class ActiveSupport::Inflector.constantize(resource_class_name) end
resource_name()
click to toggle source
# File lib/administrate/resource_resolver.rb, line 19 def resource_name model_path_parts.map(&:underscore).join("__").to_sym end
resource_title()
click to toggle source
# File lib/administrate/resource_resolver.rb, line 23 def resource_title resource_class.model_name.human end
Private Instance Methods
controller_path_parts()
click to toggle source
# File lib/administrate/resource_resolver.rb, line 37 def controller_path_parts path_parts = controller_path.split("/")[1..-1] path_parts << path_parts.pop.singularize end
model_path_parts()
click to toggle source
# File lib/administrate/resource_resolver.rb, line 33 def model_path_parts controller_path_parts.map(&:camelize) end
resource_class_name()
click to toggle source
# File lib/administrate/resource_resolver.rb, line 29 def resource_class_name model_path_parts.join("::") end