Merge pull request #650 from andhapp/fix-pull-request-486

Fixes Nested Resource Loading
This commit is contained in:
Ryan Bates
2012-06-19 10:50:29 -07:00
2 changed files with 13 additions and 1 deletions

View File

@@ -215,8 +215,12 @@ module CanCan
end
end
def namespace
@params[:controller].split("::")[0..-2]
end
def namespaced_name
@name || @params[:controller].sub("Controller", "").singularize.camelize.constantize
[namespace, name.camelize].join('::').singularize.camelize.constantize
rescue NameError
name
end