Sha256: a08e9c62ddc817dab82bde79fa535f6d594a44a66a3706bbeb8959bdbce38c80

Contents?: true

Size: 1.19 KB

Versions: 11

Compression:

Stored size: 1.19 KB

Contents

class Iro::StrategiesController < Iro::ApplicationController

  before_action :set_lists

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

  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 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
    @strategies_list = Iro::Strategy.list
    @tickers_list = Iro::Stock.tickers_list
  end

end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
iron_warbler-2.0.7.19 app/controllers/iro/strategies_controller.rb
iron_warbler-2.0.7.18 app/controllers/iro/strategies_controller.rb
iron_warbler-2.0.7.17 app/controllers/iro/strategies_controller.rb
iron_warbler-2.0.7.16 app/controllers/iro/strategies_controller.rb
iron_warbler-2.0.7.15 app/controllers/iro/strategies_controller.rb
iron_warbler-2.0.7.14 app/controllers/iro/strategies_controller.rb
iron_warbler-2.0.7.13 app/controllers/iro/strategies_controller.rb
iron_warbler-2.0.7.12 app/controllers/iro/strategies_controller.rb
iron_warbler-2.0.7.11 app/controllers/iro/strategies_controller.rb
iron_warbler-2.0.7.10 app/controllers/iro/strategies_controller.rb
iron_warbler-2.0.7.9 app/controllers/iro/strategies_controller.rb