Sha256: 68b198646fda244b3ad7c5cc32b7cd5e64a917c36f76dae58b9c29c3c0638622

Contents?: true

Size: 755 Bytes

Versions: 90

Compression:

Stored size: 755 Bytes

Contents

# frozen_string_literal: true

# Pundit ApplicationPolicy
class ApplicationPolicy
  attr_reader :user, :record

  def initialize(user, record)
    raise Pundit::NotAuthorizedError, 'must be logged in' unless user

    @user = user
    @record = record
  end

  def index?
    false
  end

  def show?
    false
  end

  def create?
    false
  end

  def new?
    false
  end

  def update?
    false
  end

  def edit?
    false
  end

  def destroy?
    false
  end

  # Pundit ApplicationPolicy - Scope
  class Scope
    attr_reader :user, :scope

    def initialize(user, scope)
      raise Pundit::NotAuthorizedError, 'must be logged in' unless user

      @user = user
      @scope = scope
    end

    def resolve
      scope.all
    end
  end
end

Version data entries

90 entries across 90 versions & 1 rubygems

Version Path
rails_app_generator-0.3.6 templates/addons/pundit/app/policies/application_policy.rb
rails_app_generator-0.3.5 templates/addons/pundit/app/policies/application_policy.rb
rails_app_generator-0.3.4 templates/addons/pundit/app/policies/application_policy.rb
rails_app_generator-0.3.3 templates/addons/pundit/app/policies/application_policy.rb
rails_app_generator-0.3.2 templates/addons/pundit/app/policies/application_policy.rb
rails_app_generator-0.3.1 templates/addons/pundit/app/policies/application_policy.rb
rails_app_generator-0.3.0 templates/addons/pundit/app/policies/application_policy.rb
rails_app_generator-0.2.43 templates/addons/pundit/app/policies/application_policy.rb
rails_app_generator-0.2.42 templates/addons/pundit/app/policies/application_policy.rb
rails_app_generator-0.2.41 templates/addons/pundit/app/policies/application_policy.rb
rails_app_generator-0.2.40 templates/addons/pundit/app/policies/application_policy.rb
rails_app_generator-0.2.39 templates/addons/pundit/app/policies/application_policy.rb
rails_app_generator-0.2.38 templates/addons/pundit/app/policies/application_policy.rb
rails_app_generator-0.2.37 templates/addons/pundit/app/policies/application_policy.rb
rails_app_generator-0.2.36 templates/addons/pundit/app/policies/application_policy.rb
rails_app_generator-0.2.35 templates/addons/pundit/app/policies/application_policy.rb
rails_app_generator-0.2.34 templates/addons/pundit/app/policies/application_policy.rb
rails_app_generator-0.2.33 templates/addons/pundit/app/policies/application_policy.rb
rails_app_generator-0.2.32 templates/addons/pundit/app/policies/application_policy.rb
rails_app_generator-0.2.31 templates/addons/pundit/app/policies/application_policy.rb