Class: Renalware::Patients::PrimaryCarePhysiciansController
- Inherits:
-
BaseController
- Object
- ApplicationController
- ApplicationController
- BaseController
- Renalware::Patients::PrimaryCarePhysiciansController
- Includes:
- Concerns::Pageable
- Defined in:
- app/controllers/renalware/patients/primary_care_physicians_controller.rb
Instance Method Summary collapse
Methods inherited from BaseController
Instance Method Details
#create ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'app/controllers/renalware/patients/primary_care_physicians_controller.rb', line 34 def create @primary_care_physician = PrimaryCarePhysician.new(primary_care_physician_params) @primary_care_physician if @primary_care_physician.save redirect_to patients_primary_care_physicians_path, notice: t(".success", model_name: "primary_care_physician") else @alternative_address = alternative_address flash.now[:error] = t(".failed", model_name: "primary_care_physician") render :new end end |
#destroy ⇒ Object
56 57 58 59 60 61 |
# File 'app/controllers/renalware/patients/primary_care_physicians_controller.rb', line 56 def destroy PrimaryCarePhysician.destroy(params[:id]) redirect_to patients_primary_care_physicians_path, notice: t(".success", model_name: "primary_care_physician") end |
#edit ⇒ Object
30 31 32 |
# File 'app/controllers/renalware/patients/primary_care_physicians_controller.rb', line 30 def edit render_form(@primary_care_physician, :edit) end |
#index ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'app/controllers/renalware/patients/primary_care_physicians_controller.rb', line 14 def index primary_care_physicians = PrimaryCarePhysician.order(:name) .includes(:address) .eager_load(practices: :address) .page(page) .per(per_page) primary_care_physicians render locals: { primary_care_physicians: primary_care_physicians } end |
#new ⇒ Object
24 25 26 27 28 |
# File 'app/controllers/renalware/patients/primary_care_physicians_controller.rb', line 24 def new @primary_care_physician = PrimaryCarePhysician.new @alternative_address = alternative_address @primary_care_physician end |
#update ⇒ Object
48 49 50 51 52 53 54 |
# File 'app/controllers/renalware/patients/primary_care_physicians_controller.rb', line 48 def update if @primary_care_physician.update(primary_care_physician_params) update_primary_care_physician_successful(@primary_care_physician) else update_primary_care_physician_failed(@primary_care_physician) end end |