Class: Welcome::ThingsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Welcome::ThingsController
- Defined in:
- app/controllers/jobshop/welcome/things_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'app/controllers/jobshop/welcome/things_controller.rb', line 19 def create if @thing = current_team.things.create(thing_params) session[:thing_id] = @thing.id session[:next_onboard_path] = new_welcome_places_path end respond_with @thing, location: -> { new_welcome_places_path } end |
#index ⇒ Object
15 16 17 |
# File 'app/controllers/jobshop/welcome/things_controller.rb', line 15 def index redirect_to new_welcome_things_path end |
#new ⇒ Object
7 8 9 10 11 12 13 |
# File 'app/controllers/jobshop/welcome/things_controller.rb', line 7 def new @thing = if session[:thing_id].present? current_team.things.find_by(id: session[:thing_id]) end @thing ||= current_team.things.build respond_with(@thing) end |
#update ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'app/controllers/jobshop/welcome/things_controller.rb', line 28 def update @thing = current_team.things.find(params[:id]) if @thing.update(thing_params) session[:thing_id] = @thing.id respond_with @thing, location: -> { new_welcome_places_path } else render :new end end |