demarches-normaliennes/app/policies/champ_policy.rb

14 lines
251 B
Ruby
Raw Normal View History

2019-06-27 16:26:07 +02:00
class ChampPolicy < ApplicationPolicy
class Scope < Scope
def resolve
2019-08-01 15:48:27 +02:00
if user.present?
2019-06-27 16:26:07 +02:00
scope
.joins(:dossier)
.where({ dossiers: { user_id: user.id } })
else
scope.none
end
end
end
end