lib/administrate/resource_resolver.rb in administrate-0.1.2 vs lib/administrate/resource_resolver.rb in administrate-0.1.3
- old
+ new
@@ -1,17 +1,19 @@
-require "administrate/namespace"
-
module Administrate
class ResourceResolver
def initialize(controller_path)
@controller_path = controller_path
end
def dashboard_class
Object.const_get(resource_class_name + "Dashboard")
end
+ def namespace
+ controller_path.split("/").first
+ end
+
def resource_class
Object.const_get(resource_class_name)
end
def resource_name
@@ -31,10 +33,10 @@
def model_path_parts
controller_path_parts.map(&:camelize)
end
def controller_path_parts
- controller_path.singularize.split("/") - [Administrate::NAMESPACE.to_s]
+ controller_path.singularize.split("/")[1..-1]
end
attr_reader :controller_path
end
end