This line is breaking my include associations:
|
policy.scope.where(id: record_id).exists? |
It works if I change from this:
def show?(policy, record_id)
policy.scope.where(id: record_id).exists?
end
# called on line 75 with:
show?(Pundit.policy!(context[:current_user], record), record.id)
To this:
def show?(policy, record, record_id)
q = {}
q[record.class.primary_key] = record_id
policy.scope.where(q).exists?
end
# call on line 75 with (note the added "record" argument):
show?(Pundit.policy!(context[:current_user], record), record, record.id)