Class: Renalware::Pathology::ObservationDescriptionsController

Inherits:
BaseController show all
Includes:
Pagy::Backend
Defined in:
app/controllers/renalware/pathology/observation_descriptions_controller.rb

Instance Method Summary collapse

Methods inherited from BaseController

#patient

Instance Method Details

#editObject



20
21
22
# File 'app/controllers/renalware/pathology/observation_descriptions_controller.rb', line 20

def edit
  render_edit find_authorise_description
end

#indexObject



10
11
12
13
14
15
16
17
18
# File 'app/controllers/renalware/pathology/observation_descriptions_controller.rb', line 10

def index
  query = ObservationDescription
    .includes(:measurement_unit)
    .order(:code)
    .ransack(params[:q] || {})
  pagy, descriptions = pagy(query.result)
  authorize descriptions
  render locals: { descriptions: descriptions, pagy: pagy, query: query }
end

#updateObject



24
25
26
27
28
29
30
31
32
33
34
# File 'app/controllers/renalware/pathology/observation_descriptions_controller.rb', line 24

def update
  description = find_authorise_description
  if description.update(description_params)
    redirect_to(
      pathology_observation_descriptions_path,
      notice: t(".success", model_name: "observation descrition")
    )
  else
    render_edit(description)
  end
end