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