Hello @palkan ! 👋
First of all, thank you for your amazing gem 💎
Here is my issue: in my mutation, I want to run the same validation multiple times, because my record may have change.
To be more specific, I have a Demand object which has a status. I have an AcceptDemand mutation, which changes the status of the demand to the next one.
But, my users may have several roles, allowing them the accept multiple statuses at a time ; so I wrote something like this :
demand.status = demand.next_status
demand.status = demand.next_status while authorize! demand, to: :accept?
However, I realized we do not re-do the checks ; once the authorize! has been called, it is never called again, and returns the same result than the first time.
The issue is the same with authorize! or allowed_to? methods.
I understand it is probably a cache feature which makes sense in most cases, but could it be possible to force the accept? policy to be run again?
Thanks for your help & have a good day 😊
Hello @palkan ! 👋
First of all, thank you for your amazing gem 💎
Here is my issue: in my mutation, I want to run the same validation multiple times, because my record may have change.
To be more specific, I have a
Demandobject which has astatus. I have anAcceptDemandmutation, which changes the status of the demand to the next one.But, my users may have several roles, allowing them the accept multiple statuses at a time ; so I wrote something like this :
However, I realized we do not re-do the checks ; once the
authorize!has been called, it is never called again, and returns the same result than the first time.The issue is the same with
authorize!orallowed_to?methods.I understand it is probably a cache feature which makes sense in most cases, but could it be possible to force the
accept?policy to be run again?Thanks for your help & have a good day 😊