Class: Renalware::HD::MDMPatientsForm

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Class Method Details

.permittable_attributesObject

StrongParameter support. Called by a controller when whitelisting params.



29
30
31
# File 'app/models/renalware/hd/mdm_patients_form.rb', line 29

def self.permittable_attributes
  attribute_set.map(&:name)
end

Instance Method Details

#ransacked_parametersObject

The hash returned here is passed into the Ransack #search method later i the ouery object.



20
21
22
23
24
25
26
# File 'app/models/renalware/hd/mdm_patients_form.rb', line 20

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