Sha256: 450d4e854abf194829982fa59e78145f239a7f8d18eb5a05b5ab9ab3e169a300
Contents?: true
Size: 1.34 KB
Versions: 11
Compression:
Stored size: 1.34 KB
Contents
class Iro::PositionsController < Iro::ApplicationController before_action :set_lists def new @position = Iro::Position.new purse_id: params[:purse_id] authorize! :new, @posision end def create @position = Iro::Position.new params[:position].permit! authorize! :create, @position if @position.save flash_notice @position redirect_to controller: :purses, action: :show, id: @position.purse_id.to_s else flash_alert @position redirect_to request.referrer end end def destroy @position = Iro::Position.find params[:id] authorize! :destroy, @position @position.delete flash_notice "Probably ok" redirect_to request.referrer end def edit @position = Iro::Position.find params[:id] authorize! :edit, @position @strategies_list = Iro::Strategy.for_ticker( @position.ticker ).list end def update @position = Iro::Position.find params[:id] authorize! :update, @position if @position.update params[:position].permit! flash_notice @position redirect_to controller: :purses, action: :show, id: @position.purse_id.to_s else flash_alert @position redirect_to request.referrer end end ## ## private ## private def set_lists @strategies_list = Iro::Strategy.list @tickers_list = Iro::Stock.tickers_list end end
Version data entries
11 entries across 11 versions & 1 rubygems