Class: Iro::PursesController
- Inherits:
-
ApplicationController
- Object
- Wco::ApplicationController
- ApplicationController
- Iro::PursesController
- Defined in:
- app/controllers/iro/purses_controller.rb
Instance Method Summary collapse
Methods inherited from ApplicationController
Instance Method Details
#create ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'app/controllers/iro/purses_controller.rb', line 6 def create @purse = Iro::Purse.new params[:purse].permit! :create, @purse if @purse.save ; else flash_alert @purse end redirect_to action: :index end |
#destroy ⇒ Object
17 18 19 20 21 22 |
# File 'app/controllers/iro/purses_controller.rb', line 17 def destroy @purse = Iro::Purse.find(params[:id]) :destroy, @purse @purse.destroy redirect_to action: :index, notice: 'Purse was successfully destroyed.' end |
#edit ⇒ Object
24 25 26 27 |
# File 'app/controllers/iro/purses_controller.rb', line 24 def edit @purse = Iro::Purse.find(params[:id]) :edit, @purse end |
#index ⇒ Object
29 30 31 32 |
# File 'app/controllers/iro/purses_controller.rb', line 29 def index @purses = Iro::Purse.all :index, Iro::Purse end |
#show ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'app/controllers/iro/purses_controller.rb', line 34 def show @purse = Iro::Purse.find(params[:id]) :show, @purse @positions = @purse.positions.where( status: 'active' ).includes( :strategy ).order( expires_on: :asc, ticker: :desc, long_or_short: :asc, inner_strike: :asc ) @unit = @purse.unit # 12 ## pixels per dollar @height = @purse.height # 100 ## pixels @n_dollars = 100 ## dollars to each side of origin calc_summary render params[:template] end |
#update ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 |
# File 'app/controllers/iro/purses_controller.rb', line 52 def update @purse = Iro::Purse.find(params[:id]) :update, @purse if @purse.update params[:purse].permit! flash[:notice] = 'ok' redirect_to request.referrer # purse_path(@purse) else flash_alert @purse render :edit end end |