Class: Renalware::Patients::MDMsController

Inherits:
BaseController show all
Includes:
Pagy::Backend, Concerns::Pageable
Defined in:
app/controllers/renalware/patients/mdms_controller.rb

Defined Under Namespace

Classes: MDMListOptions, SqlView

Instance Method Summary collapse

Methods inherited from BaseController

#patient

Instance Method Details

#showObject

rubocop:disable Metrics/MethodLength



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'app/controllers/renalware/patients/mdms_controller.rb', line 22

def show
  authorize Patient, :index?
  sql_view_klass = SqlView.new(view_name).klass
  sql_view_klass.reset_column_information
  search = sql_view_klass.ransack(params[:q])
  view_proc = ->(patient) { patient_transplants_mdm_path(patient_id: patient.secure_id) }
  pagy, patients = pagy(search.result)
  options = MDMListOptions.new(
    search: search,
    patients: patients.load, # search.result.page(page).per(5).load,
    current_view: current_view,
    view_proc: view_proc,
    pagination: pagy
  )
  render locals: { options: options }
end