Sha256: 12e14d18cab6efd21396eb0f4ad4ceb00f2b729b038d72e6548f4395620836fe

Contents?: true

Size: 862 Bytes

Versions: 8

Compression:

Stored size: 862 Bytes

Contents

class BaseModelPolicy < ApplicationPolicy
  def index? = general_rule

  def create? = general_rule

  def update? = general_rule

  def destroy? = general_rule

  def show? = general_rule

  # Questo metodo può essere anche scritto specifico per azione:
  # - permitted_attributes_for_create
  # - permitted_attributes_for_update
  def permitted_attributes = []

  def editable_attributes = []

  def permitted_attributes_for_ransack
    record.class.column_names + record.class._ransackers.keys
  end

  def permitted_associations_for_ransack
    []
  end

  def search_fields = []

  def search_result_fields = []

  ##
  # List of attributes in index to make it sortable
  def sortable_search_result_fields
    search_result_fields
  end

  class Scope < Scope
    def resolve
      scope.all
    end
  end

  private

  def general_rule
    true
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
base_editing_bootstrap-1.5.0 app/policies/base_model_policy.rb
base_editing_bootstrap-1.4.0 app/policies/base_model_policy.rb
base_editing_bootstrap-1.3.2 app/policies/base_model_policy.rb
base_editing_bootstrap-1.3.1 app/policies/base_model_policy.rb
base_editing_bootstrap-1.3.0 app/policies/base_model_policy.rb
base_editing_bootstrap-1.2.0 app/policies/base_model_policy.rb
base_editing_bootstrap-1.1.0 app/policies/base_model_policy.rb
base_editing_bootstrap-1.0.0 app/policies/base_model_policy.rb