Class: Renalware::Patients::WorryController
- Inherits:
-
BaseController
- Object
- ApplicationController
- ApplicationController
- BaseController
- Renalware::Patients::WorryController
- Defined in:
- app/controllers/renalware/patients/worry_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
idempotent.
-
#destroy ⇒ Object
idempotent.
Methods inherited from BaseController
Instance Method Details
#create ⇒ Object
idempotent
9 10 11 12 13 14 15 16 |
# File 'app/controllers/renalware/patients/worry_controller.rb', line 9 def create worry = Worry.find_or_create_by!(patient: patient) do |wor| wor.by = user end update_worry_notes_if_supplied(worry) redirect_back(fallback_location: patient_path(patient), notice: t(".success", patient: patient)) end |
#destroy ⇒ Object
idempotent
19 20 21 22 23 24 25 26 27 28 |
# File 'app/controllers/renalware/patients/worry_controller.rb', line 19 def destroy if (worry = patient.worry) worry worry.destroy! else end redirect_back(fallback_location: patient_path(patient), notice: t(".success", patient: patient)) end |