Sha256: ff9e8e2a058c3d4fe1249aaec3a6402be1907040f7d165fcb024ebf387781e1f

Contents?: true

Size: 1.25 KB

Versions: 51

Compression:

Stored size: 1.25 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)
  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

51 entries across 51 versions & 1 rubygems

Version Path
ish_manager-0.1.8.450 app/controllers/ish_manager/iro_watches_controller.rb
ish_manager-0.1.8.449 app/controllers/ish_manager/iro_watches_controller.rb
ish_manager-0.1.8.448 app/controllers/ish_manager/iro_watches_controller.rb
ish_manager-0.1.8.447 app/controllers/ish_manager/iro_watches_controller.rb
ish_manager-0.1.8.446 app/controllers/ish_manager/iro_watches_controller.rb
ish_manager-0.1.8.445 app/controllers/ish_manager/iro_watches_controller.rb
ish_manager-0.1.8.444 app/controllers/ish_manager/iro_watches_controller.rb
ish_manager-0.1.8.443 app/controllers/ish_manager/iro_watches_controller.rb
ish_manager-0.1.8.442 app/controllers/ish_manager/iro_watches_controller.rb
ish_manager-0.1.8.441 app/controllers/ish_manager/iro_watches_controller.rb
ish_manager-0.1.8.440 app/controllers/ish_manager/iro_watches_controller.rb
ish_manager-0.1.8.439 app/controllers/ish_manager/iro_watches_controller.rb
ish_manager-0.1.8.438 app/controllers/ish_manager/iro_watches_controller.rb
ish_manager-0.1.8.437 app/controllers/ish_manager/iro_watches_controller.rb
ish_manager-0.1.8.436 app/controllers/ish_manager/iro_watches_controller.rb
ish_manager-0.1.8.435 app/controllers/ish_manager/iro_watches_controller.rb
ish_manager-0.1.8.434 app/controllers/ish_manager/iro_watches_controller.rb
ish_manager-0.1.8.433 app/controllers/ish_manager/iro_watches_controller.rb
ish_manager-0.1.8.432 app/controllers/ish_manager/iro_watches_controller.rb
ish_manager-0.1.8.431 app/controllers/ish_manager/iro_watches_controller.rb