Class: IshManager::IroPositionsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- IshManager::IroPositionsController
- Defined in:
- app/controllers/ish_manager/iro_positions_controller.rb
Instance Method Summary collapse
Methods inherited from ApplicationController
Instance Method Details
#create ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'app/controllers/ish_manager/iro_positions_controller.rb', line 6 def create @position = Iro::Position.new({ iro_purse: @purse = Iro::Purse.find_or_create_by({ user_id: current_user.id }), type: 'Iro::CoveredCall', }) :update, @position if @position.update params[:position].permit! flash[:notice] = 'Successfully updated position.' redirect_to controller: 'iro_purses', action: :show else flash[:alert] = "Cannot update position: #{@position.errors.full_messages.join(', ')}." render action: 'edit' end end |
#edit ⇒ Object
22 23 24 25 |
# File 'app/controllers/ish_manager/iro_positions_controller.rb', line 22 def edit @position = Iro::Position.find params[:id] :edit, @position end |
#new ⇒ Object
27 28 29 30 |
# File 'app/controllers/ish_manager/iro_positions_controller.rb', line 27 def new @position = Iro::Position.new :new, @position end |
#update ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'app/controllers/ish_manager/iro_positions_controller.rb', line 32 def update @position = Iro::Position.find params[:id] :update, @position if @position.update params[:position].permit! flash[:notice] = 'Successfully updated position.' redirect_to controller: 'iro_purses', action: :show else flash[:alert] = "Cannot update position: #{@position.errors.full_messages.join(', ')}." render action: 'edit' end end |