Sha256: ffa92b8ca72031cd8981b71f74dfcf9c2febc7a16452e821d494d83c3169a6b0

Contents?: true

Size: 1.19 KB

Versions: 3

Compression:

Stored size: 1.19 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 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.list
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
iron_warbler-2.0.7.22 app/controllers/iro/strategies_controller.rb
iron_warbler-2.0.7.21 app/controllers/iro/strategies_controller.rb
iron_warbler-2.0.7.20 app/controllers/iro/strategies_controller.rb