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.513 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.512 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.511 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.510 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.509 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.508 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.507 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.506 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.505 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.504 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.503 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.500 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.499 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.498 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.497 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.496 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.495 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.494 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.493 app/controllers/ish_manager/iro_strategies_controller.rb
ish_manager-0.1.8.492 app/controllers/ish_manager/iro_strategies_controller.rb