Sha256: eb04d2aeaf4833a41bee14416bf4046c321a2359e43284ca05b72bd85619d5bd

Contents?: true

Size: 1.13 KB

Versions: 110

Compression:

Stored size: 1.13 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

    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

110 entries across 110 versions & 1 rubygems

Version Path
ish_manager-0.1.8.257 app/controllers/ish_manager/trash/stock_options_controller.rb
ish_manager-0.1.8.256 app/controllers/ish_manager/trash/stock_options_controller.rb
ish_manager-0.1.8.255 app/controllers/ish_manager/trash/stock_options_controller.rb
ish_manager-0.1.8.254 app/controllers/ish_manager/trash/stock_options_controller.rb
ish_manager-0.1.8.253 app/controllers/ish_manager/trash/stock_options_controller.rb
ish_manager-0.1.8.252 app/controllers/ish_manager/trash/stock_options_controller.rb
ish_manager-0.1.8.251 app/controllers/ish_manager/trash/stock_options_controller.rb
ish_manager-0.1.8.250 app/controllers/ish_manager/trash/stock_options_controller.rb
ish_manager-0.1.8.249 app/controllers/ish_manager/trash/stock_options_controller.rb
ish_manager-0.1.8.248 app/controllers/ish_manager/trash/stock_options_controller.rb
ish_manager-0.1.8.247 app/controllers/ish_manager/trash/stock_options_controller.rb
ish_manager-0.1.8.246 app/controllers/ish_manager/trash/stock_options_controller.rb
ish_manager-0.1.8.245 app/controllers/ish_manager/trash/stock_options_controller.rb
ish_manager-0.1.8.244 app/controllers/ish_manager/trash/stock_options_controller.rb
ish_manager-0.1.8.243 app/controllers/ish_manager/trash/stock_options_controller.rb
ish_manager-0.1.8.242 app/controllers/ish_manager/trash/stock_options_controller.rb
ish_manager-0.1.8.241 app/controllers/ish_manager/trash/stock_options_controller.rb
ish_manager-0.1.8.239 app/controllers/ish_manager/trash/stock_options_controller.rb
ish_manager-0.1.8.238 app/controllers/ish_manager/trash/stock_options_controller.rb
ish_manager-0.1.8.237 app/controllers/ish_manager/trash/stock_options_controller.rb