Class: Renalware::Transplants::RecipientFollowupsController

Inherits:
BaseController show all
Defined in:
app/controllers/renalware/transplants/recipient_followups_controller.rb

Instance Method Summary collapse

Methods inherited from BaseController

#patient

Methods inherited from BaseController

#patient

Instance Method Details

#createObject



21
22
23
24
25
26
27
28
29
30
31
# File 'app/controllers/renalware/transplants/recipient_followups_controller.rb', line 21

def create
  followup = copy_attributes_onto_followup(operation.build_followup)
  authorize followup
  if followup.save
    redirect_to patient_transplants_recipient_dashboard_path(patient),
                notice: success_msg_for("recipient follow up")
  else
    flash.now[:error] = failed_msg_for("recipient follow up")
    render_new(followup)
  end
end

#editObject



33
34
35
# File 'app/controllers/renalware/transplants/recipient_followups_controller.rb', line 33

def edit
  render_edit(operation.followup)
end

#newObject



17
18
19
# File 'app/controllers/renalware/transplants/recipient_followups_controller.rb', line 17

def new
  render_new(operation.build_followup)
end

#showObject

before_action :load_patient



11
12
13
14
15
# File 'app/controllers/renalware/transplants/recipient_followups_controller.rb', line 11

def show
  followup = operation.followup
  authorize followup
  render locals: { patient: patient, recipient_followup: followup }
end

#updateObject



37
38
39
40
41
42
43
44
45
46
47
# File 'app/controllers/renalware/transplants/recipient_followups_controller.rb', line 37

def update
  followup = copy_attributes_onto_followup(operation.followup)
  authorize followup
  if followup.save
    redirect_to patient_transplants_recipient_dashboard_path(patient),
                notice: success_msg_for("recipient follow up")
  else
    flash.now[:error] = failed_msg_for("recipient follow up")
    render_edit(followup)
  end
end