Sha256: 5ca4b1de0ad55c0d3f78f3e46ff1bae11ca0b6a2ef71b5a2f8e4c495744597c7

Contents?: true

Size: 737 Bytes

Versions: 12

Compression:

Stored size: 737 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 = []

  class Scope < Scope
    def resolve
      scope.all
    end
  end

  private

  def general_rule
    true
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
base_editing_bootstrap-0.16.1 app/policies/base_model_policy.rb
base_editing_bootstrap-0.16.0 app/policies/base_model_policy.rb
base_editing_bootstrap-0.15.0 app/policies/base_model_policy.rb
base_editing_bootstrap-0.14.0 app/policies/base_model_policy.rb
base_editing_bootstrap-0.13.0 app/policies/base_model_policy.rb
base_editing_bootstrap-0.12.0 app/policies/base_model_policy.rb
base_editing_bootstrap-0.11.0 app/policies/base_model_policy.rb
base_editing_bootstrap-0.10.2 app/policies/base_model_policy.rb
base_editing_bootstrap-0.10.1 app/policies/base_model_policy.rb
base_editing_bootstrap-0.10.0 app/policies/base_model_policy.rb
base_editing_bootstrap-0.9.1 app/policies/base_model_policy.rb
base_editing_bootstrap-0.9.0 app/policies/base_model_policy.rb