2015-03-18 22:02:38 +00:00
|
|
|
class SubscribePolicy < ApplicationPolicy
|
|
|
|
|
|
|
|
def create?
|
2015-04-06 22:14:04 +01:00
|
|
|
return false if user.guest?
|
|
|
|
!record.subscribeable.subscribes.exists?(user_id: user.id)
|
2015-03-18 22:02:38 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def destroy?
|
2015-04-06 22:14:04 +01:00
|
|
|
return false if user.guest?
|
|
|
|
record.subscribeable.subscribes.exists?(user_id: user.id)
|
2015-03-18 22:02:38 +00:00
|
|
|
end
|
|
|
|
end
|