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



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

def create
  recipient_followup = operation.build_followup
  recipient_followup.attributes = followup_attributes

  if recipient_followup.save
    redirect_to patient_transplants_recipient_dashboard_path(patient),
      notice: t(".success", model_name: "recipient follow up")
  else
    flash.now[:error] = t(".failed", model_name: "recipient follow up")
    render :new, locals: { patient: patient, recipient_followup: recipient_followup }
  end
end

#editObject



35
36
37
38
39
40
# File 'app/controllers/renalware/transplants/recipient_followups_controller.rb', line 35

def edit
  render locals: {
    patient: patient,
    recipient_followup: operation.followup
  }
end

#newObject



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

def new
  render locals: {
    patient: patient,
    recipient_followup: operation.build_followup
  }
end

#showObject



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

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

#updateObject



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'app/controllers/renalware/transplants/recipient_followups_controller.rb', line 42

def update
  recipient_followup = operation.followup
  recipient_followup.attributes = followup_attributes

  if recipient_followup.save
    redirect_to patient_transplants_recipient_dashboard_path(patient),
      notice: t(".success", model_name: "recipient follow up")
  else
    flash.now[:error] = t(".failed", model_name: "recipient follow up")
    render :edit,
           locals: {
             patient: patient,
             recipient_followup: recipient_followup
           }
  end
end