Class: Renalware::PD::AdequacyResultsController
- Inherits:
-
BaseController
- Object
- ApplicationController
- ApplicationController
- BaseController
- BaseController
- Renalware::PD::AdequacyResultsController
- Defined in:
- app/controllers/renalware/pd/adequacy_results_controller.rb
Instance Method Summary collapse
Methods inherited from BaseController
Instance Method Details
#create ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'app/controllers/renalware/pd/adequacy_results_controller.rb', line 14 def create adequacy = AdequacyResult.new(result_params) adequacy if adequacy.save_by(current_user) redirect_to patient_pd_dashboard_path(patient), notice: success_msg_for("Adequacy result") else render :new, locals: { adequacy: adequacy } end end |
#destroy ⇒ Object
40 41 42 43 44 |
# File 'app/controllers/renalware/pd/adequacy_results_controller.rb', line 40 def destroy result = result.destroy! redirect_to patient_pd_dashboard_path(patient), notice: success_msg_for("Result") end |
#edit ⇒ Object
25 26 27 28 29 |
# File 'app/controllers/renalware/pd/adequacy_results_controller.rb', line 25 def edit adequacy = # adequacy.derive_calculated_attributes render locals: { adequacy: adequacy } end |
#index ⇒ Object
46 47 48 49 50 51 52 53 54 |
# File 'app/controllers/renalware/pd/adequacy_results_controller.rb', line 46 def index respond_to do |format| format.js do results = patient.adequacy_results.ordered results render locals: { results: results } end end end |
#new ⇒ Object
8 9 10 11 12 |
# File 'app/controllers/renalware/pd/adequacy_results_controller.rb', line 8 def new adequacy = AdequacyResult.new(patient: patient, performed_on: Date.current) adequacy render locals: { adequacy: adequacy } end |
#update ⇒ Object
31 32 33 34 35 36 37 38 |
# File 'app/controllers/renalware/pd/adequacy_results_controller.rb', line 31 def update result = if result.update_by(current_user, result_params) redirect_to patient_pd_dashboard_path(patient), notice: success_msg_for("Result") else render_edit(result) end end |