-
Notifications
You must be signed in to change notification settings - Fork 632
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lookup policies in the current namespace #152
Conversation
Addresses #12. If the policy is not defined in `namespace`, `const_get` will search through the inheritance change of `namespace` to find the policy.
+1 |
The build failed because of an issue installing rbx. |
I submitted #153 to fix .travis.yml. |
Lookup policies in the current namespace
Very nice PR, thanks! |
hi, |
and if it possible - update gem :) |
@@ -14,7 +15,7 @@ def scope | |||
|
|||
def policy | |||
klass = find | |||
klass = klass.constantize if klass.is_a?(String) | |||
klass = namespace.const_get(klass) if klass.is_a?(String) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that klass = namespace.const_get(klass) if klass.is_a?(String)
will get the wrong policy if the object
is namespaced which is the case for engines. Basically when klass
is something like EngineName::UserPolicy
and namespace EngineName::Admin
const_get
will not return EngineName::Admin::UserPolicy
.
Hi guys! I saw this PR but I don't see the merged code anymore in the I think it is a really useful feature... Why it was removed? |
Addresses #12. If the policy is not defined in
namespace
,const_get
will search through the inheritance change of
namespace
to find thepolicy.