You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Used SimpleDelegator to decorate an object and send it to the policy.
What did you expect to happen?
Expect the correct policy to be resolved.
What actually happened?
~/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/action_policy-0.3.1/lib/action_policy.rb:32:in `lookup': Couldn't find policy class for #<Post:0x00007fe5234431c0> (ActionPolicy::NotFound)
This is not the expected behaviour: policy lookup relies on the object class (it's name or .policy_name / .policy_class methods, see docs).
In your case, the class of the object is PostDecorator (not Post) and we can only infer from it the PostDecoratorPolicy, which doesn't exist—and we fail.
We (from the library perspective) cannot know beforehand, whether you wan to use PostDecoratorPolicy or PostPolicy, that should be decide by the developer.
Tell us about your environment
Ruby Version:
2.6.3
Framework Version (Rails, whatever):
None.
Action Policy Version:
0.3.1
What did you do?
Used
SimpleDelegator
to decorate an object and send it to the policy.What did you expect to happen?
Expect the correct policy to be resolved.
What actually happened?
How to reproduce?
The text was updated successfully, but these errors were encountered: