Sha256: ad3e3ee02aeb7b52ac64f0f6deb048fda6e3af64b50e5f917f161a3d3ae57153

Contents?: true

Size: 625 Bytes

Versions: 6

Compression:

Stored size: 625 Bytes

Contents

# frozen_string_literal: true

class ApplicationPolicy
  attr_reader :user, :record

  def initialize(user, record)
    @user = user
    @record = record
  end

  def index?
    false
  end

  def show?
    false
  end

  def create?
    false
  end

  def new?
    create?
  end

  def update?
    false
  end

  def edit?
    update?
  end

  def destroy?
    false
  end

  class Scope
    def initialize(user, scope)
      @user = user
      @scope = scope
    end

    def resolve
      raise NotImplementedError, "You must define #resolve in #{self.class}"
    end

    private

    attr_reader :user, :scope
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/pundit-2.2.0/lib/generators/pundit/install/templates/application_policy.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/pundit-2.2.0/lib/generators/pundit/install/templates/application_policy.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/pundit-2.2.0/lib/generators/pundit/install/templates/application_policy.rb
pundit-2.3.1 lib/generators/pundit/install/templates/application_policy.rb
pundit-2.3.0 lib/generators/pundit/install/templates/application_policy.rb
pundit-2.2.0 lib/generators/pundit/install/templates/application_policy.rb