Class: IshManager::IroStrategiesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- IshManager::IroStrategiesController
- Defined in:
- app/controllers/ish_manager/iro_strategies_controller.rb
Instance Method Summary collapse
Methods inherited from ApplicationController
Instance Method Details
#create ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'app/controllers/ish_manager/iro_strategies_controller.rb', line 4 def create @strategy = Iro::CoveredCallStrategy.new params[:iro_strategy].permit! @strategy.iro_purse_id = Iro::Purse.where( user_id: current_user.id ).first.id :create, @strategy flag = @strategy.save if flag flash[:notice] = 'Success.' redirect_to my_purse_path else flash[:alert] = "No luck: #{@strategy.full_errors..join(', ')}." render action: 'new' end end |
#edit ⇒ Object
18 19 20 21 |
# File 'app/controllers/ish_manager/iro_strategies_controller.rb', line 18 def edit @strategy = Iro::CoveredCallStrategy.find params[:id] :edit, @strategy end |
#new ⇒ Object
23 24 25 26 |
# File 'app/controllers/ish_manager/iro_strategies_controller.rb', line 23 def new @strategy = Iro::CoveredCallStrategy.new :new, @strategy end |
#update ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'app/controllers/ish_manager/iro_strategies_controller.rb', line 28 def update @strategy = Iro::CoveredCallStrategy.find params[:id] :update, @strategy flag = @strategy.update params[:iro_strategy].permit! if flag flash[:notice] = 'Success.' redirect_to my_purse_path else flash[:alert] = "No luck: #{@strategy.full_errors..join(', ')}." render action: 'new' end end |