Class: Renalware::Patients::MDMsController::SqlView
- Inherits:
-
Object
- Object
- Renalware::Patients::MDMsController::SqlView
- Defined in:
- app/controllers/renalware/patients/mdms_controller.rb
Instance Method Summary collapse
-
#klass ⇒ Object
- Create a class under Renalware
-
for this SQL name Note that Ransack search_form_for requires our otherwise anonymous class to have a name.
Instance Method Details
#klass ⇒ Object
- Create a class under Renalware
-
for this SQL name
Note that Ransack search_form_for requires our otherwise anonymous class to have a name.
70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'app/controllers/renalware/patients/mdms_controller.rb', line 70 def klass return Renalware.const_get(class_name) if class_exists? = view_name Class.new(ApplicationRecord) do self.table_name = define_method(:to_s, ->(_x) { patient_name }) define_method(:to_param, -> { secure_id }) end.tap do |klass| Renalware.const_set(class_name, klass) # klass.connection # not sure this is required. end end |