Class: Renalware::HD::PrescriptionAdministrationsController
- Inherits:
-
BaseController
- Object
- ApplicationController
- ApplicationController
- BaseController
- BaseController
- Renalware::HD::PrescriptionAdministrationsController
- Includes:
- Concerns::Pageable
- Defined in:
- app/controllers/renalware/hd/prescription_administrations_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST JS issues - user validation not working.
- #index ⇒ Object
-
#new ⇒ Object
GET HTML.
Methods inherited from BaseController
Instance Method Details
#create ⇒ Object
POST JS issues - user validation not working
35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'app/controllers/renalware/hd/prescription_administrations_controller.rb', line 35 def create administration = hd_patient.prescription_administrations.build( prescription_administration_parameters ) clear_irrelevant_attributes_if_drug_was_not_administered(administration) administration if administration.save_by(current_user) # will render create.js else render_new(administration) # re-display dialog with errors end end |
#index ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'app/controllers/renalware/hd/prescription_administrations_controller.rb', line 11 def index hd_patient = HD.cast_patient(patient) administrations = hd_patient .prescription_administrations .includes(:administered_by, :witnessed_by, :reason, :prescription) .ordered .page(page) .per(per_page) administrations render locals: { prescription_administrations: administrations } end |
#new ⇒ Object
GET HTML
24 25 26 27 28 29 30 31 |
# File 'app/controllers/renalware/hd/prescription_administrations_controller.rb', line 24 def new administration = hd_patient.prescription_administrations.build( prescription: prescription, administered_by: current_user, recorded_on: Date.current ) render_new(administration) end |