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