I need to call Pundit authorization in a Rails Presenter.
I included Pundit so I can call policy function. But Pundit does not know current_user. (Rails 6 / Devise / Pundit)
Is there a way to do this ?
app/presenter/cause_presenter.rb
class CausePresenter < BasePresenter
include Pundit
def cause_tree_line
# Here I want to call policy or authorize
end
end
Result :
NameError (undefined local variable or method `current_user' for #<Tools::CausePresenter:0x00007f3f408b2050>
Thanks for your help.