Fixed bug where parent resources were being regarded as children

This commit is contained in:
Oliver Morgan
2012-06-04 17:44:33 +01:00
parent 245b83f6b4
commit 354e34b8ab
2 changed files with 14 additions and 2 deletions
+2 -2
View File
@@ -145,7 +145,7 @@ module CanCan
def resource_class
case @options[:class]
when false then name.to_sym
when nil then (@name || namespaced_name).to_s.camelize.constantize
when nil then namespaced_name.to_s.camelize.constantize
when String then @options[:class].constantize
else @options[:class]
end
@@ -230,7 +230,7 @@ module CanCan
end
def namespaced_name
@params[:controller].sub("Controller", "").singularize.camelize.constantize
(@name || @params[:controller].sub("Controller", "")).singularize.camelize.constantize
rescue NameError
name
end