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.451 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.450 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.449 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.448 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.447 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.446 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.445 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.444 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.443 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.442 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.441 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.440 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.439 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.438 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.437 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.436 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.435 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.434 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.433 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.432 app/controllers/ish_manager/iro_strategies_controller.rb