Sha256: 1bdc2a08cff93fb1ccc394e1d522f19ff2cdb6b2109443de4d57fd7965b1fd41

Contents?: true

Size: 609 Bytes

Versions: 28

Compression:

Stored size: 609 Bytes

Contents

class ApplicationPolicy
  attr_reader :user, :record

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

  def index?
    false
  end

  def show?
    scope.where(id: record.id).exists?
  end

  def new?
    create?
  end

  def create?
    false
  end

  def edit?
    update?
  end

  def update?
    false
  end

  def destroy?
    false
  end

  def scope
    Pundit.policy_scope!(user, record.class)
  end

  class Scope
    attr_reader :user, :scope

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

    def resolve
      scope
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
renalware-core-2.0.8 app/policies/application_policy.rb
renalware-core-2.0.7 app/policies/application_policy.rb
renalware-core-2.0.5 app/policies/application_policy.rb
renalware-core-2.0.4 app/policies/application_policy.rb
renalware-core-2.0.3 app/policies/application_policy.rb
renalware-core-2.0.2 app/policies/application_policy.rb
renalware-core-2.0.1 app/policies/application_policy.rb
renalware-core-2.0.0 app/policies/application_policy.rb
renalware-core-2.0.0.pre.rc13 app/policies/application_policy.rb
renalware-core-2.0.0.pre.rc11 app/policies/application_policy.rb
renalware-core-2.0.0.pre.rc10 app/policies/application_policy.rb
renalware-core-2.0.0.pre.rc9 app/policies/application_policy.rb
renalware-core-2.0.0.pre.rc8 app/policies/application_policy.rb
renalware-core-2.0.0.pre.rc7 app/policies/application_policy.rb
renalware-core-2.0.0.pre.rc6 app/policies/application_policy.rb
renalware-core-2.0.0.pre.rc5 app/policies/application_policy.rb
renalware-core-2.0.0.pre.rc4 app/policies/application_policy.rb
renalware-core-2.0.0.pre.rc3 app/policies/application_policy.rb
renalware-core-2.0.0.pre.rc1 app/policies/application_policy.rb
renalware-core-2.0.0.pre.beta12 app/policies/application_policy.rb