When to use validations or policies
So, continuing the discussion from #general.
Can you elaborate more about when should I use validation and when to use policies?
If I got it right, seems like I should use policies for things related to the actor and validations to things related to some resource.
Is that correct?
5 Replies
Another question related to this.
I was playing around with validations here, I created this validation:
But the only way I found to apply it was to add it to the validations block in my resources like this:
This is fine, but I would prefer to add it directly inside my action, is that possible?
Yep!
You can just do
inside the action
I tried that, but for some reason it doesn't work, it will not run the validation 🤔
This is how my action is right now:
Ah... no, ignore it, I found the issue
@Zach Daniel is it correct to assume that validations will always run before the policies for a specific action?
Yes
All right, thanks!