Sha256: 82e8fa313c72b81d7908a6644fdd67160ff02dbf93356d3023fd38a3b4d8b113

Contents?: true

Size: 1007 Bytes

Versions: 8

Compression:

Stored size: 1007 Bytes

Contents

class Iro::AlertsController < Iro::ApplicationController

  before_action :set_lists

  def create
    @alert = Iro::Alert.new(alert_params)
    if @alert.save
      redirect_to action: :index, notice: 'Alert was successfully created.'
    else
      render :new
    end
  end

  def destroy
    @alert = Iro::Alert.find(params[:id])
    @alert.destroy
    redirect_to action: :index, notice: 'Alert was successfully destroyed.'
  end

  def index
    @alerts = Iro::Alert.all
  end

  def update
    @alert = Iro::Alert.find(params[:id])
    if @alert.update(alert_params)
      redirect_to action: :index, notice: 'Alert was successfully updated.'
    else
      render :edit
    end
  end

  ##
  ## private
  ##
  private

  def alert_params
    params.require(:alert).permit(:class_name, :kind, :symbol, :direction, :strike, :profile_id)
  end

  def set_lists
    # @profiles_list = Wco::Profile.list
    @stocks_list = [[nil,nil]] + Iro::Stock.active.map { |s| [ s.ticker, s.ticker ] }
  end


end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
iron_warbler-2.0.7.8 app/controllers/iro/alerts_controller.rb
iron_warbler-2.0.7.7 app/controllers/iro/alerts_controller.rb
iron_warbler-2.0.7.6 app/controllers/iro/alerts_controller.rb
iron_warbler-2.0.7.5 app/controllers/iro/alerts_controller.rb
iron_warbler-2.0.7.4 app/controllers/iro/alerts_controller.rb
iron_warbler-2.0.7.3 app/controllers/iro/alerts_controller.rb
iron_warbler-2.0.7.2 app/controllers/iro/alerts_controller.rb
iron_warbler-2.0.7.1 app/controllers/iro/alerts_controller.rb