Sha256: 47ec556c6ce98d89c883f435bb8d3466d3ecf400b760af5f4e58e690f1d170be

Contents?: true

Size: 596 Bytes

Versions: 141

Compression:

Stored size: 596 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?
    true
  end

  def create?
    true
  end

  def new?
    create?
  end

  def update?
    false
  end

  def edit?
    update?
  end

  def destroy?
    false
  end

  def history?
    create?
  end

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

    def resolve
      scope.all
    end

    private

    attr_reader :user, :scope
  end
end

Version data entries

141 entries across 141 versions & 1 rubygems

Version Path
cm-admin-1.5.47 lib/generators/cm_admin/templates/application_policy.rb
cm-admin-1.5.46 lib/generators/cm_admin/templates/application_policy.rb
cm-admin-1.5.45 lib/generators/cm_admin/templates/application_policy.rb
cm-admin-1.5.44 lib/generators/cm_admin/templates/application_policy.rb
cm-admin-1.5.43 lib/generators/cm_admin/templates/application_policy.rb
cm-admin-1.5.42 lib/generators/cm_admin/templates/application_policy.rb
cm-admin-1.5.41 lib/generators/cm_admin/templates/application_policy.rb
cm-admin-1.5.40 lib/generators/cm_admin/templates/application_policy.rb
cm-admin-1.5.39 lib/generators/cm_admin/templates/application_policy.rb
cm-admin-1.5.38 lib/generators/cm_admin/templates/application_policy.rb
cm-admin-1.5.37 lib/generators/cm_admin/templates/application_policy.rb
cm-admin-1.5.36 lib/generators/cm_admin/templates/application_policy.rb
cm-admin-1.5.35 lib/generators/cm_admin/templates/application_policy.rb
cm-admin-1.5.34 lib/generators/cm_admin/templates/application_policy.rb
cm-admin-1.5.33 lib/generators/cm_admin/templates/application_policy.rb
cm-admin-1.5.32 lib/generators/cm_admin/templates/application_policy.rb
cm-admin-1.5.31 lib/generators/cm_admin/templates/application_policy.rb
cm-admin-1.5.30 lib/generators/cm_admin/templates/application_policy.rb
cm-admin-1.5.29 lib/generators/cm_admin/templates/application_policy.rb
cm-admin-1.5.28 lib/generators/cm_admin/templates/application_policy.rb