demarches-normaliennes/app/policies/champ_policy.rb
2019-08-01 16:41:53 +02:00

13 lines
251 B
Ruby

class ChampPolicy < ApplicationPolicy
class Scope < Scope
def resolve
if user.present?
scope
.joins(:dossier)
.where({ dossiers: { user_id: user.id } })
else
scope.none
end
end
end
end