I'm using the pundit gem and trying to figure out how to use it to prevent access to an index page that belongs to a user other than the current_user.
The examples only talk about how to scope the results to the current_user but no how to actually prevent access to the page itself if the current_user is NOT the owner of the record.
Any help appreciated
Thanks
index?withuser_posts?. See comment from @Fede Bonisconti below for an alternative suggestion as to where to put theauthorized_to_edit?logic. If you include it anywhere other than the User model, you will need to callauthorized_to_edit?(current_user)instead ofcurrent_user.authorized_to_edit?- moveson