Class: BaseModelPolicy

Inherits:
ApplicationPolicy
  • Object
show all
Defined in:
app/policies/base_model_policy.rb

Defined Under Namespace

Classes: Scope

Instance Method Summary collapse

Instance Method Details

#create?Boolean

Returns:

  • (Boolean)


4
# File 'app/policies/base_model_policy.rb', line 4

def create? = general_rule

#destroy?Boolean

Returns:

  • (Boolean)


8
# File 'app/policies/base_model_policy.rb', line 8

def destroy? = general_rule

#editable_attributesObject



17
# File 'app/policies/base_model_policy.rb', line 17

def editable_attributes = []

#index?Boolean

Returns:

  • (Boolean)


2
# File 'app/policies/base_model_policy.rb', line 2

def index? = general_rule

#permitted_associations_for_ransackObject



23
24
25
# File 'app/policies/base_model_policy.rb', line 23

def permitted_associations_for_ransack
  []
end

#permitted_attributesObject

Questo metodo può essere anche scritto specifico per azione:

  • permitted_attributes_for_create

  • permitted_attributes_for_update



15
# File 'app/policies/base_model_policy.rb', line 15

def permitted_attributes = []

#permitted_attributes_for_ransackObject



19
20
21
# File 'app/policies/base_model_policy.rb', line 19

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

#search_fieldsObject



27
# File 'app/policies/base_model_policy.rb', line 27

def search_fields = []

#search_result_fieldsObject



29
# File 'app/policies/base_model_policy.rb', line 29

def search_result_fields = []

#show?Boolean

Returns:

  • (Boolean)


10
# File 'app/policies/base_model_policy.rb', line 10

def show? = general_rule

#update?Boolean

Returns:

  • (Boolean)


6
# File 'app/policies/base_model_policy.rb', line 6

def update? = general_rule