Sha256: f9d2584b49c1916afafb190f0e3c1b9512b59ffa2e4337aafc0ad4278ff2db8c

Contents?: true

Size: 609 Bytes

Versions: 34

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 create?
    false
  end

  def new?
    create?
  end

  def update?
    false
  end

  def edit?
    update?
  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

34 entries across 33 versions & 2 rubygems

Version Path
enju_seed-0.3.6 app/policies/application_policy.rb
enju_seed-0.3.5 app/policies/application_policy.rb
enju_seed-0.4.0.rc.2 app/policies/application_policy.rb
enju_seed-0.3.4 app/policies/application_policy.rb
enju_seed-0.4.0.rc.1 app/policies/application_policy.rb
enju_seed-0.4.0.beta.3 app/policies/application_policy.rb
enju_seed-0.5.0.beta.1 app/policies/application_policy.rb
enju_seed-0.4.0.beta.2 app/policies/application_policy.rb
enju_seed-0.3.3 app/policies/application_policy.rb
enju_seed-0.3.2 app/policies/application_policy.rb
enju_seed-0.3.1 app/policies/application_policy.rb
enju_seed-0.3.0 app/policies/application_policy.rb
enju_seed-0.3.0.rc.1 app/policies/application_policy.rb
enju_seed-0.3.0.beta.7 app/policies/application_policy.rb
enju_seed-0.4.0.beta.1 app/policies/application_policy.rb
enju_seed-0.3.0.beta.6 app/policies/application_policy.rb
enju_seed-0.2.3 app/policies/application_policy.rb
enju_seed-0.3.0.beta.4 app/policies/application_policy.rb
enju_seed-0.2.2 app/policies/application_policy.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/enju_seed-0.2.0/app/policies/application_policy.rb