Sha256: 7c4aa7fd436faf2da78f90e0d975ba1da25aa7f4bc66dfcfdec9eb4721fbb3ce

Contents?: true

Size: 691 Bytes

Versions: 2

Compression:

Stored size: 691 Bytes

Contents

# frozen_string_literal: true

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

  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

2 entries across 2 versions & 1 rubygems

Version Path
schienenzeppelin-0.2 templates/app/policies/application_policy.rb
schienenzeppelin-0.1 templates/app/policies/application_policy.rb