I am running a data extract with delayed_job that uses existing .html_erb templates that contain Pundit authorisations for example:
<%if policy(client).view_contacts? %>
Normally Pundit will look for a 'current_user' method in the controller to setup the Pundit policy class. However I have no controller as the job is being run from an ActiveJob using an instance of ActionView::Base to do the rendering.
I can change all the policy calls to be of the form:
<%if ClientPolicy.new(my_current_user,client).view_contacts? %>
However I would prefer to have a 'current_user' method that would be found by Pundit