Class: Renalware::Events::TypesController
- Inherits:
-
BaseController
- Object
- ApplicationController
- ApplicationController
- BaseController
- Renalware::Events::TypesController
- Defined in:
- app/controllers/renalware/events/types_controller.rb
Instance Method Summary collapse
Methods inherited from BaseController
Instance Method Details
#create ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'app/controllers/renalware/events/types_controller.rb', line 14 def create event_type = Type.new(event_params) event_type if event_type.save redirect_to events_types_path, notice: success_msg_for("event type") else flash.now[:error] = failed_msg_for("event type") render :new, locals: { event_type: event_type } end end |
#destroy ⇒ Object
46 47 48 49 50 |
# File 'app/controllers/renalware/events/types_controller.rb', line 46 def destroy event_type = event_type.destroy redirect_to events_types_path, notice: success_msg_for("event type") end |
#edit ⇒ Object
31 32 33 34 |
# File 'app/controllers/renalware/events/types_controller.rb', line 31 def edit event_type = render locals: { event_type: event_type } end |
#index ⇒ Object
25 26 27 28 29 |
# File 'app/controllers/renalware/events/types_controller.rb', line 25 def index event_types = Type.all event_types render locals: { event_types: event_types } end |
#new ⇒ Object
8 9 10 11 12 |
# File 'app/controllers/renalware/events/types_controller.rb', line 8 def new event_type = Type.new event_type render locals: { event_type: event_type } end |
#update ⇒ Object
36 37 38 39 40 41 42 43 44 |
# File 'app/controllers/renalware/events/types_controller.rb', line 36 def update event_type = if event_type.update(event_params) redirect_to events_types_path, notice: success_msg_for("event type") else flash.now[:error] = failed_msg_for("event type") render :edit, locals: { event_type: event_type } end end |