Sha256: ba80edecb346365d039d2c5f5649c9edca848dd1e9335a9e77906dce3fbe4fed
Contents?: true
Size: 581 Bytes
Versions: 10
Compression:
Stored size: 581 Bytes
Contents
module Proclaim class SubscriptionPolicy < ApplicationPolicy def create? # A user can subscribe to anything. Guests can only subscribe to # published posts or the blog in general. if @user.nil? and @record.post @record.post.published? else true end end def unsubscribe? destroy? end def destroy? true # Anyone can unsubscribe (it requires a token anyway) end class Scope < Scope def resolve if @user scope.all # Users can access all subscriptions else # Guests can see none nil end end end end end
Version data entries
10 entries across 10 versions & 1 rubygems