Class: Renalware::Pathology::PatientRulesController

Inherits:
BaseController show all
Defined in:
app/controllers/renalware/pathology/patient_rules_controller.rb

Instance Method Summary collapse

Methods inherited from BaseController

#patient

Instance Method Details

#createObject



16
17
18
19
20
21
22
23
24
25
26
# File 'app/controllers/renalware/pathology/patient_rules_controller.rb', line 16

def create
  patient_rule = @patient.rules.new(patient_rule_params)

  if patient_rule.save
    redirect_to patient_pathology_required_observations_path(@patient),
                notice: t(".success", model_name: "Patient Rule")
  else
    flash.now[:error] = t(".failed", model_name: "Patient Rule")
    render_new(patient_rule)
  end
end

#destroyObject



46
47
48
49
50
51
# File 'app/controllers/renalware/pathology/patient_rules_controller.rb', line 46

def destroy
  Requests::PatientRule.destroy(params[:id])

  redirect_to patient_pathology_required_observations_path(@patient),
              notice: t(".success", model_name: "patient rule")
end

#editObject



28
29
30
31
32
# File 'app/controllers/renalware/pathology/patient_rules_controller.rb', line 28

def edit
  patient_rule = @patient.rules.find(params[:id])

  render_edit(patient_rule)
end

#newObject



10
11
12
13
14
# File 'app/controllers/renalware/pathology/patient_rules_controller.rb', line 10

def new
  patient_rule = @patient.rules.new

  render_new(patient_rule)
end

#updateObject



34
35
36
37
38
39
40
41
42
43
44
# File 'app/controllers/renalware/pathology/patient_rules_controller.rb', line 34

def update
  patient_rule = @patient.rules.find(params[:id])

  if patient_rule.update(patient_rule_params)
    redirect_to patient_pathology_required_observations_path(@patient),
                notice: t(".success", model_name: "patient rule")
  else
    flash.now[:error] = t(".failed", model_name: "patient rule")
    render_edit(patient_rule)
  end
end