About the `matches/1` builtin check. I completely forgot about it.

Thanks @Vonagam 😆 Added a year ago.
authorize_if matches("bar is even", fn _actor, context ->
rem(context.changeset.arguments.bar, 2) == 0
end)
authorize_if matches("bar is even", fn _actor, context ->
rem(context.changeset.arguments.bar, 2) == 0
end)
2 Replies
Vonagam
Vonagam•3w ago
Hah, I use it quite often. Usually in matches("should be good", &check_is_good/2) form to not pollute dsl code. Though when I chose name I did not know about built-in match validation (about string patterns), if I did I would have chosen another name, like check or something.
ZachDaniel
ZachDanielOP•3w ago
We can always add a new function in builtins and deprecate that if we want.

Did you find this page helpful?