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

symbol policy lookup in namespace #122

Closed
skojin opened this issue Jul 7, 2020 · 1 comment
Closed

symbol policy lookup in namespace #122

skojin opened this issue Jul 7, 2020 · 1 comment
Labels
bug Something isn't working

Comments

@skojin
Copy link
Contributor

skojin commented Jul 7, 2020

Tell us about your environment

Ruby Version: 2.6.2

Framework Version (Rails, whatever): rails 6.0.3.1

Action Policy Version: action_policy (0.4.3)

What did you do?

class ReportPolicy < ApplicationPolicy
  def manage?
    true
  end
end

class Report::Default < ApplicationController
  def index
    authorize! :report
  end
end

What did you expect to happen?

I expect that ReportPolicy will be found according to
https://actionpolicy.evilmartians.io/#/lookup_chain and https://actionpolicy.evilmartians.io/#/namespaces

What actually happened?

I got error
Couldn't find policy class for :report (Symbol)

If I rename policy to Report::ReportPolicy then it found

@palkan palkan added investigate Something is probably wrong bug Something isn't working and removed investigate Something is probably wrong labels Jul 7, 2020
@palkan palkan closed this as completed in f66ae50 Jul 7, 2020
@palkan
Copy link
Owner

palkan commented Jul 7, 2020

Thanks for reporting!
Fixed and released in 0.4.4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants