Fixed bug where parent resources were being regarded as children
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user