Sha256: 67190968dbd47529d324258b3439c81f7d65ca22faf280444a0affbda6af7832

Contents?: true

Size: 422 Bytes

Versions: 54

Compression:

Stored size: 422 Bytes

Contents

module Dorsale::CommentPolicyHelper
  POLICY_METHODS = [
    :create?,
    :update?,
    :delete?,
  ]

  def create?
    return false unless can_read_commentable?
    super
  end

  def update?
    return false unless can_read_commentable?
    super
  end

  def delete?
    return false unless can_read_commentable?
    super
  end

  private

  def can_read_commentable?
    policy(comment.commentable).read?
  end
end

Version data entries

54 entries across 54 versions & 1 rubygems

Version Path
dorsale-4.0.0 app/policies/dorsale/comment_policy_helper.rb
dorsale-3.20.0 app/policies/dorsale/comment_policy_helper.rb
dorsale-3.19.1 app/policies/dorsale/comment_policy_helper.rb
dorsale-3.19.0 app/policies/dorsale/comment_policy_helper.rb
dorsale-3.18.0 app/policies/dorsale/comment_policy_helper.rb
dorsale-3.17.0 app/policies/dorsale/comment_policy_helper.rb
dorsale-3.16.0 app/policies/dorsale/comment_policy_helper.rb
dorsale-3.15.0 app/policies/dorsale/comment_policy_helper.rb
dorsale-3.14.11 app/policies/dorsale/comment_policy_helper.rb
dorsale-3.14.10 app/policies/dorsale/comment_policy_helper.rb
dorsale-3.14.9 app/policies/dorsale/comment_policy_helper.rb
dorsale-3.14.8 app/policies/dorsale/comment_policy_helper.rb
dorsale-3.14.7 app/policies/dorsale/comment_policy_helper.rb
dorsale-3.14.6 app/policies/dorsale/comment_policy_helper.rb
dorsale-3.14.5 app/policies/dorsale/comment_policy_helper.rb
dorsale-3.14.4 app/policies/dorsale/comment_policy_helper.rb
dorsale-3.14.3 app/policies/dorsale/comment_policy_helper.rb
dorsale-3.14.2 app/policies/dorsale/comment_policy_helper.rb
dorsale-3.14.1 app/policies/dorsale/comment_policy_helper.rb
dorsale-3.14.0 app/policies/dorsale/comment_policy_helper.rb