Sha256: 966c85c097b8c0f73ec447b8052c39b9355e555f232bf1e140586f0db13452c4

Contents?: true

Size: 730 Bytes

Versions: 9

Compression:

Stored size: 730 Bytes

Contents

class BaseModelPolicy < ApplicationPolicy
  def index? = general_rule

  def create? = general_rule

  def update? = general_rule

  def destroy? = general_rule

  def show? = false

  # 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

9 entries across 9 versions & 1 rubygems

Version Path
base_editing_bootstrap-0.8.0 app/policies/base_model_policy.rb
base_editing_bootstrap-0.7.0 app/policies/base_model_policy.rb
base_editing_bootstrap-0.6.0 app/policies/base_model_policy.rb
base_editing_bootstrap-0.4.1 app/policies/base_model_policy.rb
base_editing_bootstrap-0.4.0 app/policies/base_model_policy.rb
base_editing_bootstrap-0.3.0 app/policies/base_model_policy.rb
base_editing_bootstrap-0.2.0 app/policies/base_model_policy.rb
base_editing_bootstrap-0.1.4 app/policies/base_model_policy.rb
base_editing_bootstrap-0.1.2 app/policies/base_model_policy.rb