Sha256: cd52010a27f8a7237e9615aba9a0d6c13e7593d667a55f75fc75a9a753550031

Contents?: true

Size: 1.2 KB

Versions: 96

Compression:

Stored size: 1.2 KB

Contents

class ::IshManager::IroStrategiesController < IshManager::ApplicationController

  def create
    @strategy = Iro::CoveredCallStrategy.new params[:iro_strategy].permit!
    # @strategy.iro_purse_id = Iro::Purse.where( user_id: current_user.id ).first.id
    authorize! :create, @strategy
    flag = @strategy.save
    if flag
      flash[:notice] = 'Success.'
      redirect_to controller: 'ish_manager/iro_purses', action: :show, id: @strategy.iro_purse_id
    else
      flash[:alert] = "No luck: #{@strategy.errors.full_messages.join(', ')}."
      render action: 'new'
    end
  end

  def edit
    @strategy = Iro::CoveredCallStrategy.find params[:id]
    authorize! :edit, @strategy
  end

  def new
    @strategy = Iro::CoveredCallStrategy.new
    authorize! :new, @strategy
  end

  def update
    @strategy = Iro::CoveredCallStrategy.find params[:id]
    authorize! :update, @strategy
    flag = @strategy.update params[:iro_strategy].permit!
    if flag
      flash[:notice] = 'Success.'
      redirect_to controller: 'ish_manager/iro_purses', action: :show, id: @strategy.iro_purse_id
    else
      flash[:alert] = "No luck: #{@strategy.errors.full_messages.join(', ')}."
      render action: 'new'
    end
  end

end

Version data entries

96 entries across 96 versions & 1 rubygems

Version Path
ish_manager-0.1.8.491 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.490 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.489 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.488 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.487 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.486 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.485 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.484 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.483 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.482 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.481 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.480 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.479 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.478 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.477 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.476 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.475 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.474 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.473 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.472 app/controllers/ish_manager/iro_strategies_controller.rb