I have the following hash:
MAPPING = {
create: [:admin],
update: [:admin],
delete: [:admin],
index: [:all]
}
And I need to create pundit method dynamically in the policy class. I need to search the mapping hash all items that have admin role and create policy methods:
def create?
true
end
def update?
true
end
This way I don't have to repeat the code all the time. How can I do this ? Thanks.