From 38ee93996457ed01f8334cf74fde911913463a4f Mon Sep 17 00:00:00 2001 From: NehamaMandelbaum Date: Wed, 27 Dec 2023 14:51:22 -0300 Subject: [PATCH] adding more ransack methods --- app/models/allocation.rb | 4 ++++ app/models/education_experience.rb | 4 ++++ app/models/evaluation.rb | 5 +++++ app/models/office.rb | 4 ++++ app/models/project.rb | 4 ++++ app/models/questionnaire.rb | 4 ++++ app/models/regional_holiday.rb | 4 ++++ app/models/talk.rb | 4 ++++ app/models/vacation.rb | 5 +++++ 9 files changed, 38 insertions(+) diff --git a/app/models/allocation.rb b/app/models/allocation.rb index 0a83b504..5c25ae02 100644 --- a/app/models/allocation.rb +++ b/app/models/allocation.rb @@ -65,6 +65,10 @@ def self.ransackable_attributes(_auth_object = nil) updated_at user_id] end + def self.ransackable_associations(_auth_object = nil) + %w[project user] + end + private def end_before_start? diff --git a/app/models/education_experience.rb b/app/models/education_experience.rb index e330cd33..ed20a60a 100644 --- a/app/models/education_experience.rb +++ b/app/models/education_experience.rb @@ -20,4 +20,8 @@ class EducationExperience < ApplicationRecord def self.ransackable_associations(_auth_object = nil) ["user"] end + + def self.ransackable_attributes(_auth_object = nil) + %w[course created_at end_date id institution start_date updated_at user_id] + end end diff --git a/app/models/evaluation.rb b/app/models/evaluation.rb index 54ba2537..daa4a1d3 100644 --- a/app/models/evaluation.rb +++ b/app/models/evaluation.rb @@ -32,6 +32,11 @@ def self.ransackable_associations(_auth_object = nil) %w[answers evaluated evaluator questionnaire] end + def self.ransackable_attributes(_auth_object = nil) + %w[created_at english_level evaluated_id evaluation_date evaluator_id id observation + questionnaire_id score updated_at] + end + private def update_office_score diff --git a/app/models/office.rb b/app/models/office.rb index 0f2b255d..3ad36bda 100644 --- a/app/models/office.rb +++ b/app/models/office.rb @@ -26,4 +26,8 @@ def calculate_score def self.ransackable_associations(_auth_object = nil) %w[head users users_without_head] end + + def self.ransackable_attributes(_auth_object = nil) + %w[active city created_at head_id id score updated_at users_count] + end end diff --git a/app/models/project.rb b/app/models/project.rb index c1963ca3..1b254752 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -35,4 +35,8 @@ def to_s def self.ransackable_attributes(_auth_object = nil) %w[active created_at id market name updated_at] end + + def self.ransackable_associations(_auth_object = nil) + %w[allocations punches] + end end diff --git a/app/models/questionnaire.rb b/app/models/questionnaire.rb index c2c03dda..7148fae4 100644 --- a/app/models/questionnaire.rb +++ b/app/models/questionnaire.rb @@ -36,4 +36,8 @@ def to_s def self.ransackable_attributes(_auth_object = nil) %w[active created_at description id kind title updated_at] end + + def self.ransackable_associations(_auth_object = nil) + %w[evaluations questions] + end end diff --git a/app/models/regional_holiday.rb b/app/models/regional_holiday.rb index c78b8d4f..0dbcadc5 100644 --- a/app/models/regional_holiday.rb +++ b/app/models/regional_holiday.rb @@ -18,6 +18,10 @@ def self.ransackable_attributes(_auth_object = nil) %w[created_at day id month name updated_at] end + def self.ransackable_associations(_auth_object = nil) + ["cities"] + end + private def valid_date? diff --git a/app/models/talk.rb b/app/models/talk.rb index d2f6b44c..a675b167 100644 --- a/app/models/talk.rb +++ b/app/models/talk.rb @@ -10,6 +10,10 @@ def self.ransackable_associations(_auth_object = nil) ["user"] end + def self.ransackable_attributes(_auth_object = nil) + %w[created_at date event_name id talk_title updated_at user_id] + end + private def future_date? diff --git a/app/models/vacation.rb b/app/models/vacation.rb index 7caf5f25..edc397aa 100644 --- a/app/models/vacation.rb +++ b/app/models/vacation.rb @@ -95,6 +95,11 @@ def self.ransackable_associations(_auth_object = nil) %w[commercial_approver denier hr_approver user] end + def self.ransackable_attributes(_auth_object = nil) + %w[commercial_approver_id created_at denier_id end_date hr_approver_id id start_date status + updated_at user_id] + end + private def approved_within_cancel_range?