Class: Renalware::Clinical::DryWeightsController
- Inherits:
-
BaseController
- Object
- ApplicationController
- ApplicationController
- BaseController
- BaseController
- Renalware::Clinical::DryWeightsController
- Includes:
- Renalware::Concerns::Pageable
- Defined in:
- app/controllers/renalware/clinical/dry_weights_controller.rb
Instance Method Summary collapse
Methods inherited from BaseController
Methods inherited from BaseController
Instance Method Details
#create ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'app/controllers/renalware/clinical/dry_weights_controller.rb', line 38 def create dry_weight = DryWeight.new(patient: patient) dry_weight.attributes = dry_weight_params if dry_weight.save redirect_to return_url, notice: t(".success", model_name: "dry weight") session.delete(:return_to) else flash.now[:error] = t(".failed", model_name: "dry weight") render_new(dry_weight) end end |
#index ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'app/controllers/renalware/clinical/dry_weights_controller.rb', line 12 def index query = PatientDryWeightsQuery.new(patient: patient, search_params: params[:q]) dry_weights = query.call.page(page).per(per_page) render locals: { search: query.search, dry_weights: CollectionPresenter.new(dry_weights, DryWeightPresenter), patient: patient } end |
#new ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'app/controllers/renalware/clinical/dry_weights_controller.rb', line 28 def new save_path_to_return_to dry_weight = DryWeight.new( patient: patient, assessor: current_user, assessed_on: Time.zone.today ) render_new(dry_weight) end |
#show ⇒ Object
23 24 25 26 |
# File 'app/controllers/renalware/clinical/dry_weights_controller.rb', line 23 def show dry_weight = DryWeight.for_patient(patient).find(params[:id]) @dry_weight = DryWeightPresenter.new(dry_weight) end |