Class: OnboardOnRails::Admin::StepsController
- Inherits:
-
BaseController
- Object
- ActionController::Base
- OnboardOnRails::ApplicationController
- BaseController
- OnboardOnRails::Admin::StepsController
- Defined in:
- app/controllers/onboard_on_rails/admin/steps_controller.rb
Instance Method Summary collapse
Methods inherited from BaseController
Instance Method Details
#create ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'app/controllers/onboard_on_rails/admin/steps_controller.rb', line 11 def create @step = @tour.steps.build(step_params) @step.position ||= @tour.steps.count if @step.save redirect_to edit_admin_tour_path(@tour), notice: t("onboard_on_rails.flash.step_created") else render :new, status: :unprocessable_entity end end |
#destroy ⇒ Object
32 33 34 35 |
# File 'app/controllers/onboard_on_rails/admin/steps_controller.rb', line 32 def destroy @step.destroy redirect_to edit_admin_tour_path(@tour), notice: t("onboard_on_rails.flash.step_deleted") end |
#edit ⇒ Object
21 22 |
# File 'app/controllers/onboard_on_rails/admin/steps_controller.rb', line 21 def edit end |
#new ⇒ Object
7 8 9 |
# File 'app/controllers/onboard_on_rails/admin/steps_controller.rb', line 7 def new @step = @tour.steps.build(position: @tour.steps.count + 1) end |
#update ⇒ Object
24 25 26 27 28 29 30 |
# File 'app/controllers/onboard_on_rails/admin/steps_controller.rb', line 24 def update if @step.update(step_params) redirect_to edit_admin_tour_step_path(@tour, @step), notice: t("onboard_on_rails.flash.step_updated") else render :edit, status: :unprocessable_entity end end |