Class: Renalware::Virology::VaccinationTypesController
- Inherits:
-
BaseController
- Object
- ApplicationController
- ApplicationController
- BaseController
- BaseController
- Renalware::Virology::VaccinationTypesController
- Defined in:
- app/controllers/renalware/virology/vaccination_types_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #sort ⇒ Object
- #update ⇒ Object
Methods inherited from BaseController
Instance Method Details
#create ⇒ Object
34 35 36 37 38 39 40 41 42 |
# File 'app/controllers/renalware/virology/vaccination_types_controller.rb', line 34 def create type = VaccinationType.new(type_params) type if type.save redirect_to virology_vaccination_types_path else render :new, locals: { type: type } end end |
#destroy ⇒ Object
44 45 46 47 |
# File 'app/controllers/renalware/virology/vaccination_types_controller.rb', line 44 def destroy .destroy! redirect_to virology_vaccination_types_path end |
#edit ⇒ Object
14 15 16 17 |
# File 'app/controllers/renalware/virology/vaccination_types_controller.rb', line 14 def edit type = render locals: { type: type } end |
#index ⇒ Object
8 9 10 11 12 |
# File 'app/controllers/renalware/virology/vaccination_types_controller.rb', line 8 def index types = VaccinationType.with_deleted.ordered types render locals: { types: types } end |
#new ⇒ Object
28 29 30 31 32 |
# File 'app/controllers/renalware/virology/vaccination_types_controller.rb', line 28 def new type = VaccinationType.new type render locals: { type: type } end |
#sort ⇒ Object
49 50 51 52 53 54 |
# File 'app/controllers/renalware/virology/vaccination_types_controller.rb', line 49 def sort VaccinationType, :sort? ids = params[:virology_vaccination_type] VaccinationType.sort(ids) render json: ids end |
#update ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'app/controllers/renalware/virology/vaccination_types_controller.rb', line 19 def update type = if type.update(type_params) redirect_to virology_vaccination_types_path else render :edit, locals: { type: type } end end |