Skip to content
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

Generated ApplicationPolicy #index? #17

Closed
bemurphy opened this issue Mar 9, 2013 · 2 comments
Closed

Generated ApplicationPolicy #index? #17

bemurphy opened this issue Mar 9, 2013 · 2 comments

Comments

@bemurphy
Copy link
Contributor

bemurphy commented Mar 9, 2013

I'm confused as to why the default generated index policy looks like this:

def index?
  scope.exists?
end

In the example scope where(:published => true) that would throw an exception on the empty set, which in this case doesn't really mean failed authorization, it might really be empty. Perhaps this is why the verify_authorization is suggesting skipping index, because you just need to rely on the scope finder all the time instead?

@jnicklas
Copy link
Collaborator

jnicklas commented Mar 9, 2013

You're right. That's probably not optimal. We should remove that or replace it with something more sensible.

bemurphy added a commit to bemurphy/pundit that referenced this issue Mar 9, 2013
See varvetgh-17 for initial discussion.  I think that the default provided
before this commit is confusing, because an empty result is not a
good indicator of authorzation failure.  Returning false better
communicates "override this is you want it".
bemurphy added a commit to bemurphy/pundit that referenced this issue Mar 9, 2013
See varvetgh-17 for initial discussion.  I think that the default provided
before this commit is confusing, because an empty result is not a
good indicator of authorization failure.  Returning false better
communicates "override this is you want it".
@jnicklas
Copy link
Collaborator

Merged the pull request. Closing. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants