Referencing action argument in policy
Hey all. I have a
create action where the argument is an instance of my Maps.Map struct, like so
Maps.Map has a belongs_to relationship with a User. I'm trying to set up a policy so that only the owner of the map can use the create action above.
I can get this to work by using matches, but it feels like there's a more built-in way I should be able to do this.
I've tried context_equals like so but this doesn't work
I know I can also write a SimpleCheck module that defines the same logic above, but this feels like something there would be a built in way to handle.
Thanks3 Replies
I believe
^arg(:name) should work in that contextIn this case I need to access the
user_id attribute of the arg.'arg(:arg, [:user_id])`