I'm using tabulatr2 to handle table alike data. However I can't wrap my head around how to include pundit's policy checks in tabulatr2's data definition.
So I have something akin to
class MystuffTabulatrData < Tabulatr::Data
column :blah
buttons do |b,r|
if policy(r).destroy? # XXX: NoMethodError - undefined method `policy' for #<Data::Proxy:0x83f84bb0>
...
end
end
end
One usually uses something like <%= table_for Mystuff %>
in a view.
Since we work with Data::Proxy there, the source suggests that @controller
should be available. So @controller.policy(r)
works just fine.