AE
Ash Elixir•3y ago
Blibs

Use `action/1` with more than one action in policies

Right now I'm doing my policies like this:
policy action(:some_action) do
...
end

policy action(:another_action) do
...
end

...
policy action(:some_action) do
...
end

policy action(:another_action) do
...
end

...
Sometimes more than one action have the same policies, so I was wondering if there is some option to do something like this:
policy action([:some_action, :another_action]) do
...
end
policy action([:some_action, :another_action]) do
...
end
3 Replies
ZachDaniel
ZachDaniel•3y ago
I just recently pushed something to main to make that work So that will work as you have stated it It may already have been released, but I did it recently
Blibs
BlibsOP•3y ago
Yep, it works great!
ZachDaniel
ZachDaniel•3y ago
🥳

Did you find this page helpful?