Class: BaseModelPolicy
- Inherits:
-
ApplicationPolicy
- Object
- ApplicationPolicy
- BaseModelPolicy
- Defined in:
- app/policies/base_model_policy.rb
Defined Under Namespace
Classes: Scope
Instance Method Summary collapse
- #create? ⇒ Boolean
- #destroy? ⇒ Boolean
- #editable_attributes ⇒ Object
- #index? ⇒ Boolean
- #permitted_associations_for_ransack ⇒ Object
-
#permitted_attributes ⇒ Object
Questo metodo può essere anche scritto specifico per azione: - permitted_attributes_for_create - permitted_attributes_for_update.
- #permitted_attributes_for_ransack ⇒ Object
- #search_fields ⇒ Object
- #search_result_fields ⇒ Object
- #show? ⇒ Boolean
- #update? ⇒ Boolean
Instance Method Details
#create? ⇒ Boolean
4 |
# File 'app/policies/base_model_policy.rb', line 4 def create? = general_rule |
#destroy? ⇒ Boolean
8 |
# File 'app/policies/base_model_policy.rb', line 8 def destroy? = general_rule |
#editable_attributes ⇒ Object
17 |
# File 'app/policies/base_model_policy.rb', line 17 def editable_attributes = [] |
#index? ⇒ Boolean
2 |
# File 'app/policies/base_model_policy.rb', line 2 def index? = general_rule |
#permitted_associations_for_ransack ⇒ Object
23 24 25 |
# File 'app/policies/base_model_policy.rb', line 23 def permitted_associations_for_ransack [] end |
#permitted_attributes ⇒ Object
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_ransack ⇒ Object
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_fields ⇒ Object
27 |
# File 'app/policies/base_model_policy.rb', line 27 def search_fields = [] |
#search_result_fields ⇒ Object
29 |
# File 'app/policies/base_model_policy.rb', line 29 def search_result_fields = [] |
#show? ⇒ Boolean
10 |
# File 'app/policies/base_model_policy.rb', line 10 def show? = general_rule |
#update? ⇒ Boolean
6 |
# File 'app/policies/base_model_policy.rb', line 6 def update? = general_rule |