Sha256: c1839a6e368de6de2732939bdd344b5ee1be94f0fd7ac88fa1dcbf206dc58c39

Contents?: true

Size: 471 Bytes

Versions: 19

Compression:

Stored size: 471 Bytes

Contents

class ApplicationPolicy
  attr_reader :user, :record

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

  def index?
    true
  end

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

  def new?
    create?
  end

  def create?
    true
  end

  def edit?
    update?
  end

  def update?
    true
  end

  def destroy?
    true
  end

  def destroy_all?
    true
  end

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

Version data entries

19 entries across 19 versions & 4 rubygems

Version Path
activeadmin-rails-1.7.1 spec/support/templates/policies/application_policy.rb
activeadmin-rails-1.7.0 spec/support/templates/policies/application_policy.rb
activeadmin-rb-1.6.0 spec/support/templates/policies/application_policy.rb
activeadmin-rb-1.5.2 spec/support/templates/policies/application_policy.rb
activeadmin-rb-1.5.1 spec/support/templates/policies/application_policy.rb
activeadmin-rb-1.5.0 spec/support/templates/policies/application_policy.rb
activeadmin_addons-1.7.1 vendor/bundle/ruby/2.3.0/bundler/gems/activeadmin-f71b375325eb/spec/support/templates/policies/application_policy.rb
activeadmin-rb-1.4.0 spec/support/templates/policies/application_policy.rb
activeadmin_addons-1.7.0 vendor/bundle/ruby/2.3.0/bundler/gems/activeadmin-f71b375325eb/spec/support/templates/policies/application_policy.rb
activeadmin-1.3.1 spec/support/templates/policies/application_policy.rb
activeadmin_addons-1.6.0 vendor/bundle/ruby/2.3.0/bundler/gems/activeadmin-f71b375325eb/spec/support/templates/policies/application_policy.rb
activeadmin_addons-1.5.0 vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-f71b375325eb/spec/support/templates/policies/application_policy.rb
activeadmin-1.3.0 spec/support/templates/policies/application_policy.rb
activeadmin_addons-1.4.0 vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-f71b375325eb/spec/support/templates/policies/application_policy.rb
activeadmin_addons-1.3.0 vendor/bundle/ruby/2.3.0/bundler/gems/activeadmin-f71b375325eb/spec/support/templates/policies/application_policy.rb
activeadmin_addons-1.2.0 vendor/bundle/ruby/2.3.0/bundler/gems/activeadmin-f71b375325eb/spec/support/templates/policies/application_policy.rb
activeadmin-1.2.1 spec/support/templates/policies/application_policy.rb
activeadmin-1.2.0 spec/support/templates/policies/application_policy.rb
activeadmin-1.1.0 spec/support/templates/policies/application_policy.rb