Sha256: 2f02579cfa01cf6358a99dd4ffc829131c4224d1a3aadabb879a9dae895f7bd4

Contents?: true

Size: 1.21 KB

Versions: 2

Compression:

Stored size: 1.21 KB

Contents

class ::IshManager::IroAlertsController < IshManager::ApplicationController

  # before_action :set_lists

  def create
    @alert = Iro::Alert.new params[:iro_alert].permit!
    authorize! :create, @alert
    flag = @alert.save
    if flag
      flash[:notice] = 'Created iro alert.'
    else
      flash[:alert] = "Cannot create iro alert: #{@alert.errors.full_messages.join(', ')}."
    end
    redirect_to action: 'index'
  end

  def destroy
    @w = Iro::Alert.find params[:id]
    authorize! :destroy, @w
    flag = @w.destroy
    if flag
      flash[:notice] = 'Success.'
    else
      flash[:alert] = @w.errors.full_messages.join(", ")
    end
    redirect_to action: 'index'
  end

  def index
    authorize! :index, Iro::Alert
    @alerts = Iro::Alert.order_by( ticker: :asc, direction: :asc, price: :desc)
    @option_get_chains = Iro::OptionGet.all_get_chains
  end

  def update
    @alert = Iro::Alert.find params[:id]
    authorize! :update, @alert
    flag = @alert.update_attributes params[:iro_alert].permit!
    if flag
      flash[:notice] = 'Updated iro alert.'
    else
      flash[:alert] = "Cannot update iro alert: #{@alert.errors.full_messages.join(', ')}."
    end
    redirect_to action: 'index'
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ish_manager-0.1.8.513 app/controllers/ish_manager/iro_alerts_controller.rb
ish_manager-0.1.8.512 app/controllers/ish_manager/iro_alerts_controller.rb