Class: Renalware::HD::MDMPatientsForm
- Inherits:
-
Object
- Object
- Renalware::HD::MDMPatientsForm
- Includes:
- ActiveModel::Model, Virtus::Model
- Defined in:
- app/models/renalware/hd/mdm_patients_form.rb
Overview
Form object to help us map chosen input values in the HD MDM patient list filters form into ransack predicates. Used in this instance because mapping the form’s schedule_definition_ids dropdown value in the format of e.g “[1, 3, 6]” into the integer arry [1, 3, 6] is not something Ransack can do - hence this intermediate form object to do the mapping.
Class Method Summary collapse
-
.permittable_attributes ⇒ Object
StrongParameter support.
Instance Method Summary collapse
-
#ransacked_parameters ⇒ Object
The hash returned here is passed into the Ransack #search method later i the ouery object.
Class Method Details
.permittable_attributes ⇒ Object
StrongParameter support. Called by a controller when whitelisting params.
28 29 30 |
# File 'app/models/renalware/hd/mdm_patients_form.rb', line 28 def self.permittable_attributes attribute_set.map(&:name) end |
Instance Method Details
#ransacked_parameters ⇒ Object
The hash returned here is passed into the Ransack #search method later i the ouery object.
19 20 21 22 23 24 25 |
# File 'app/models/renalware/hd/mdm_patients_form.rb', line 19 def ransacked_parameters { hd_profile_hospital_unit_id_eq: hospital_unit_id, hd_profile_schedule_definition_id_in: schedule_definition_ids_array, hd_profile_named_nurse_id_eq: named_nurse_id } end |