mirror of
https://github.com/Evolix/chexpire.git
synced 2024-05-27 12:48:48 +02:00
22 lines
292 B
Ruby
22 lines
292 B
Ruby
|
class NotificationPolicy < ApplicationPolicy
|
||
|
class Scope < Scope
|
||
|
def resolve
|
||
|
scope.joins(:check).where(checks: { user: user })
|
||
|
end
|
||
|
end
|
||
|
|
||
|
def destroy?
|
||
|
check_owner?
|
||
|
end
|
||
|
|
||
|
def show?
|
||
|
false
|
||
|
end
|
||
|
|
||
|
private
|
||
|
|
||
|
def check_owner?
|
||
|
record.check.user == user
|
||
|
end
|
||
|
end
|