rosa-build/app/policies/subscribe_policy.rb

13 lines
278 B
Ruby
Raw Normal View History

class SubscribePolicy < ApplicationPolicy
def create?
return false if user.guest?
!record.subscribeable.subscribes.exists?(user_id: user.id)
end
def destroy?
return false if user.guest?
record.subscribeable.subscribes.exists?(user_id: user.id)
end
end