Sha256: dbb98cceef82ba06201db56cd2c76c3dcccdf48623adf763f3c793cbc67750d3

Contents?: true

Size: 1.14 KB

Versions: 70

Compression:

Stored size: 1.14 KB

Contents

class IshManager::StockOptionsController < IshManager::ApplicationController

  def index
    authorize! :index, Ish::StockOption
    @profiles = IshModels::UserProfile.all
    @stock_options = Ish::StockOption.all.includes( :profile )
    @stock_option = Ish::StockOption.new
    render 'index', :layout => 'ish_manager/application_no_materialize'
  end

  def create
    @stock_option = Ish::StockOption.new params[:ish_stock_option].permit!
    @stock_option.profile = current_user.profile
    authorize! :create, @stock_option
    flag = @stock_option.save

    byebug

    if flag
      flash[:notice] = 'Created stock option.'
    else
      flash[:alert] = "Cannot create stock option: #{@stock_option.errors.messages}"
    end
    redirect_to :action => 'index'
  end

  def update
    @stock_option = Ish::StockOption.find params[:id]
    authorize! :update, @stock_option
    flag = @stock_option.update_attributes params[:ish_stock_option].permit!
    if flag
      flash[:notice] = 'Updated stock option.'
    else
      flash[:alert] = "Cannot update stock option: #{@stock_option.errors.messages}"
    end
    redirect_to :action => 'index'
  end

end



Version data entries

70 entries across 70 versions & 1 rubygems

Version Path
ish_manager-0.1.8.129 app/controllers/ish_manager/stock_options_controller.rb
ish_manager-0.1.8.128 app/controllers/ish_manager/stock_options_controller.rb
ish_manager-0.1.8.127 app/controllers/ish_manager/stock_options_controller.rb
ish_manager-0.1.8.126 app/controllers/ish_manager/stock_options_controller.rb
ish_manager-0.1.8.125 app/controllers/ish_manager/stock_options_controller.rb
ish_manager-0.1.8.124 app/controllers/ish_manager/stock_options_controller.rb
ish_manager-0.1.8.123 app/controllers/ish_manager/stock_options_controller.rb
ish_manager-0.1.8.122 app/controllers/ish_manager/stock_options_controller.rb
ish_manager-0.1.8.121 app/controllers/ish_manager/stock_options_controller.rb
ish_manager-0.1.8.120 app/controllers/ish_manager/stock_options_controller.rb
ish_manager-0.1.8.119 app/controllers/ish_manager/stock_options_controller.rb
ish_manager-0.1.8.118 app/controllers/ish_manager/stock_options_controller.rb
ish_manager-0.1.8.117 app/controllers/ish_manager/stock_options_controller.rb
ish_manager-0.1.8.116 app/controllers/ish_manager/stock_options_controller.rb
ish_manager-0.1.8.115 app/controllers/ish_manager/stock_options_controller.rb
ish_manager-0.1.8.114 app/controllers/ish_manager/stock_options_controller.rb
ish_manager-0.1.8.113 app/controllers/ish_manager/stock_options_controller.rb
ish_manager-0.1.8.112 app/controllers/ish_manager/stock_options_controller.rb
ish_manager-0.1.8.111 app/controllers/ish_manager/stock_options_controller.rb
ish_manager-0.1.8.110 app/controllers/ish_manager/stock_options_controller.rb