Class: Proclaim::SubscriptionPolicy
- Inherits:
-
ApplicationPolicy
- Object
- ApplicationPolicy
- Proclaim::SubscriptionPolicy
- Defined in:
- app/policies/proclaim/subscription_policy.rb
Defined Under Namespace
Classes: Scope
Instance Attribute Summary
Attributes inherited from ApplicationPolicy
Instance Method Summary collapse
Methods inherited from ApplicationPolicy
#edit?, #index?, #initialize, #new?, #scope, #show?, #update?
Constructor Details
This class inherits a constructor from ApplicationPolicy
Instance Method Details
#create? ⇒ Boolean
3 4 5 6 7 8 9 10 11 |
# File 'app/policies/proclaim/subscription_policy.rb', line 3 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 |
#destroy? ⇒ Boolean
17 18 19 |
# File 'app/policies/proclaim/subscription_policy.rb', line 17 def destroy? true # Anyone can unsubscribe (it requires a token anyway) end |
#unsubscribe? ⇒ Boolean
13 14 15 |
# File 'app/policies/proclaim/subscription_policy.rb', line 13 def unsubscribe? destroy? end |