Class: Renalware::Accesses::PlansController
- Inherits:
-
BaseController
- Object
- ApplicationController
- Renalware::ApplicationController
- BaseController
- BaseController
- Renalware::Accesses::PlansController
- Defined in:
- app/controllers/renalware/accesses/plans_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
-
#edit ⇒ Object
Because editing a plan means creating a new current version (and terminating the previous current one), we just render the new template using an instance of the current plan.
- #new ⇒ Object
- #show ⇒ Object
Methods inherited from BaseController
Instance Method Details
#create ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'app/controllers/renalware/accesses/plans_controller.rb', line 12 def create plan = patient.plans.new(plan_params.merge!(by: current_user)) plan if save_as_current(plan) redirect_to patient_accesses_dashboard_path(patient), notice: success_msg_for("access plan") else render_new(plan) end end |
#edit ⇒ Object
Because editing a plan means creating a new current version (and terminating the previous current one), we just render the new template using an instance of the current plan.
25 26 27 |
# File 'app/controllers/renalware/accesses/plans_controller.rb', line 25 def edit render_new(.dup) end |
#new ⇒ Object
6 7 8 9 10 |
# File 'app/controllers/renalware/accesses/plans_controller.rb', line 6 def new plan = Plan.new plan render_new(plan) end |
#show ⇒ Object
29 30 31 32 33 34 |
# File 'app/controllers/renalware/accesses/plans_controller.rb', line 29 def show render locals: { patient: patient, plan: } end |