Sha256: 29d37185fa7af937f0e9d4599b137ad9fd462576a21f1fd76ab7ef8b63936b50

Contents?: true

Size: 1.33 KB

Versions: 21

Compression:

Stored size: 1.33 KB

Contents

class Iro::StrategiesController < Iro::ApplicationController

  before_action :set_lists

  def create
    @strategy = Iro::Strategy.new params[:strategy].permit!
    authorize! :create, @strategy

    if @strategy.save
      flash_notice @strategy
    else
      flash_alert @strategy
    end

    redirect_to action: :index
  end

  def destroy
    @strategy = Iro::Strategy.find params[:id]
    authorize! :destroy, @strategy
    @strategy.delete
    flash_notice "Probably ok"
    redirect_to request.referrer
  end

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

  def index
    authorize! :index, Iro::Strategy
    @strategies = Iro::Strategy.all

    # render '_table'
  end

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

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



  def update
    @strategy = Iro::Strategy.find params[:id]
    authorize! :update, @strategy

    if @strategy.update params[:strategy].permit!
      flash_notice @strategy
    else
      flash_alert @strategy
    end

    redirect_to action: :index
  end

  ##
  ## private
  ##
  private

  def set_lists
    super

    @purses_list     = Iro::Purse.list
    @strategies_list = Iro::Strategy.list
    @stocks_list     = Iro::Stock.list
  end

end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
iron_warbler-2.0.7.43 app/controllers/iro/strategies_controller.rb
iron_warbler-2.0.7.42 app/controllers/iro/strategies_controller.rb
iron_warbler-2.0.7.41 app/controllers/iro/strategies_controller.rb
iron_warbler-2.0.7.40 app/controllers/iro/strategies_controller.rb
iron_warbler-2.0.7.39 app/controllers/iro/strategies_controller.rb
iron_warbler-2.0.7.38 app/controllers/iro/strategies_controller.rb
iron_warbler-2.0.7.37 app/controllers/iro/strategies_controller.rb
iron_warbler-2.0.7.36 app/controllers/iro/strategies_controller.rb
iron_warbler-2.0.7.35 app/controllers/iro/strategies_controller.rb
iron_warbler-2.0.7.34 app/controllers/iro/strategies_controller.rb
iron_warbler-2.0.7.33 app/controllers/iro/strategies_controller.rb
iron_warbler-2.0.7.32 app/controllers/iro/strategies_controller.rb
iron_warbler-2.0.7.31 app/controllers/iro/strategies_controller.rb
iron_warbler-2.0.7.30 app/controllers/iro/strategies_controller.rb
iron_warbler-2.0.7.29 app/controllers/iro/strategies_controller.rb
iron_warbler-2.0.7.28 app/controllers/iro/strategies_controller.rb
iron_warbler-2.0.7.27 app/controllers/iro/strategies_controller.rb
iron_warbler-2.0.7.26 app/controllers/iro/strategies_controller.rb
iron_warbler-2.0.7.25 app/controllers/iro/strategies_controller.rb
iron_warbler-2.0.7.24 app/controllers/iro/strategies_controller.rb