Merge branch 'master' into 2.0
This commit is contained in:
@@ -141,7 +141,7 @@ module CanCan
|
||||
def resource_class
|
||||
case @options[:class]
|
||||
when false then name.to_sym
|
||||
when nil then name.to_s.camelize.constantize
|
||||
when nil then namespaced_name.to_s.camelize.constantize
|
||||
when String then @options[:class].constantize
|
||||
else @options[:class]
|
||||
end
|
||||
@@ -220,6 +220,12 @@ module CanCan
|
||||
@name || name_from_controller
|
||||
end
|
||||
|
||||
def namespaced_name
|
||||
@params[:controller].sub("Controller", "").singularize.camelize.constantize
|
||||
rescue NameError
|
||||
name
|
||||
end
|
||||
|
||||
def name_from_controller
|
||||
@params[:controller].sub("Controller", "").underscore.split('/').last.singularize
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user