Sha256: 488c5ca6f9ca538de0dd928359c43d3c4f4d2c4aa9a5e8ae993a661e0426b283

Contents?: true

Size: 1.39 KB

Versions: 35

Compression:

Stored size: 1.39 KB

Contents

class ::IshManager::IroPositionsController < IshManager::ApplicationController

  before_action :set_lists

  def create
    @position = Iro::Position.new({
      type: 'Iro::CoveredCall',
    })
    authorize! :update, @position

    if @position.update params[:iro_position].permit!
      flash[:notice] = 'Successfully updated position.'
      redirect_to controller: 'iro_purses', action: :show, id: params[:iro_position][:iro_purse_id]
    else
      flash[:alert] = "Cannot update position: #{@position.errors.full_messages.join(', ')}."
      render action: 'edit'
    end
  end

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

  def new
    @position = Iro::Position.new
    authorize! :new, @position
  end

  ## prepare to roll
  def roll
    @position = Iro::Position.find( params[:id] )
    # puts! @position, 'zze'

    authorize! :roll, @position
    @next_positions = Iro::Position.find( 13, 14, 15, 16 )
  end

  def update
    @position = Iro::Position.find params[:id]
    authorize! :update, @position

    if @position.update params[:iro_position].permit!
      flash[:notice] = 'Successfully updated position.'
      redirect_to controller: 'iro_purses', action: :show, id: @position[:iro_purse_id]
    else
      flash[:alert] = "Cannot update position: #{@position.errors.full_messages.join(', ')}."
      render action: 'edit'
    end
  end

end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
ish_manager-0.1.8.450 app/controllers/ish_manager/iro_positions_controller.rb
ish_manager-0.1.8.449 app/controllers/ish_manager/iro_positions_controller.rb
ish_manager-0.1.8.448 app/controllers/ish_manager/iro_positions_controller.rb
ish_manager-0.1.8.447 app/controllers/ish_manager/iro_positions_controller.rb
ish_manager-0.1.8.446 app/controllers/ish_manager/iro_positions_controller.rb
ish_manager-0.1.8.445 app/controllers/ish_manager/iro_positions_controller.rb
ish_manager-0.1.8.444 app/controllers/ish_manager/iro_positions_controller.rb
ish_manager-0.1.8.443 app/controllers/ish_manager/iro_positions_controller.rb
ish_manager-0.1.8.442 app/controllers/ish_manager/iro_positions_controller.rb
ish_manager-0.1.8.441 app/controllers/ish_manager/iro_positions_controller.rb
ish_manager-0.1.8.440 app/controllers/ish_manager/iro_positions_controller.rb
ish_manager-0.1.8.439 app/controllers/ish_manager/iro_positions_controller.rb
ish_manager-0.1.8.438 app/controllers/ish_manager/iro_positions_controller.rb
ish_manager-0.1.8.437 app/controllers/ish_manager/iro_positions_controller.rb
ish_manager-0.1.8.436 app/controllers/ish_manager/iro_positions_controller.rb
ish_manager-0.1.8.435 app/controllers/ish_manager/iro_positions_controller.rb
ish_manager-0.1.8.434 app/controllers/ish_manager/iro_positions_controller.rb
ish_manager-0.1.8.433 app/controllers/ish_manager/iro_positions_controller.rb
ish_manager-0.1.8.432 app/controllers/ish_manager/iro_positions_controller.rb
ish_manager-0.1.8.431 app/controllers/ish_manager/iro_positions_controller.rb