Sha256: 80e365ae134119714478dcf33ad3cfe8dae9e46187401320766f89bc6d0c25b0

Contents?: true

Size: 1.31 KB

Versions: 59

Compression:

Stored size: 1.31 KB

Contents

class ::IshManager::IroWatchesController < IshManager::ApplicationController

  # before_action :set_lists

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

  def destroy
    @w = Iro::OptionWatch.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::OptionWatch
    @watches = Iro::OptionWatch.order_by( ticker: :asc, direction: :asc, price: :desc)
    @option_get_chains = Iro::OptionGet.all_get_chains
  end

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

end

Version data entries

59 entries across 59 versions & 1 rubygems

Version Path
ish_manager-0.1.8.511 app/controllers/ish_manager/iro_watches_controller.rb
ish_manager-0.1.8.510 app/controllers/ish_manager/iro_watches_controller.rb
ish_manager-0.1.8.509 app/controllers/ish_manager/iro_watches_controller.rb
ish_manager-0.1.8.508 app/controllers/ish_manager/iro_watches_controller.rb
ish_manager-0.1.8.507 app/controllers/ish_manager/iro_watches_controller.rb
ish_manager-0.1.8.506 app/controllers/ish_manager/iro_watches_controller.rb
ish_manager-0.1.8.505 app/controllers/ish_manager/iro_watches_controller.rb
ish_manager-0.1.8.504 app/controllers/ish_manager/iro_watches_controller.rb
ish_manager-0.1.8.503 app/controllers/ish_manager/iro_watches_controller.rb
ish_manager-0.1.8.500 app/controllers/ish_manager/iro_watches_controller.rb
ish_manager-0.1.8.499 app/controllers/ish_manager/iro_watches_controller.rb
ish_manager-0.1.8.498 app/controllers/ish_manager/iro_watches_controller.rb
ish_manager-0.1.8.497 app/controllers/ish_manager/iro_watches_controller.rb
ish_manager-0.1.8.496 app/controllers/ish_manager/iro_watches_controller.rb
ish_manager-0.1.8.495 app/controllers/ish_manager/iro_watches_controller.rb
ish_manager-0.1.8.494 app/controllers/ish_manager/iro_watches_controller.rb
ish_manager-0.1.8.493 app/controllers/ish_manager/iro_watches_controller.rb
ish_manager-0.1.8.492 app/controllers/ish_manager/iro_watches_controller.rb
ish_manager-0.1.8.491 app/controllers/ish_manager/iro_watches_controller.rb
ish_manager-0.1.8.490 app/controllers/ish_manager/iro_watches_controller.rb