Class: Iro::StrategiesController
- Inherits:
-
ApplicationController
- Object
- Wco::ApplicationController
- ApplicationController
- Iro::StrategiesController
- Defined in:
- app/controllers/iro/strategies_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Methods inherited from ApplicationController
Instance Method Details
#create ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/controllers/iro/strategies_controller.rb', line 6 def create @strategy = Iro::Strategy.new params[:strategy].permit! :create, @strategy if @strategy[:kind] == Iro::Strategy::KIND_WHEEL @strategy.long_or_short = Iro::Strategy::LONG @strategy.credit_or_debit = Iro::Strategy::DEBIT end if @strategy.save flash_notice @strategy redirect_to action: :index else flash_alert @strategy render action: 'new' end end |
#destroy ⇒ Object
24 25 26 27 28 29 30 |
# File 'app/controllers/iro/strategies_controller.rb', line 24 def destroy @strategy = Iro::Strategy.find params[:id] :destroy, @strategy @strategy.delete flash_notice "Probably ok" redirect_to request.referrer end |
#edit ⇒ Object
32 33 34 35 |
# File 'app/controllers/iro/strategies_controller.rb', line 32 def edit @strategy = Iro::Strategy.find params[:id] :edit, @strategy end |
#index ⇒ Object
37 38 39 40 41 42 |
# File 'app/controllers/iro/strategies_controller.rb', line 37 def index :index, Iro::Strategy @strategies = Iro::Strategy.all # render '_table' end |
#new ⇒ Object
44 45 46 47 |
# File 'app/controllers/iro/strategies_controller.rb', line 44 def new @strategy = Iro::Strategy.new({ kind: params[:kind] }) :new, @posision end |
#show ⇒ Object
49 50 51 52 |
# File 'app/controllers/iro/strategies_controller.rb', line 49 def show @strategy = Iro::Strategy.find params[:id] :show, @strategy end |
#update ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'app/controllers/iro/strategies_controller.rb', line 56 def update @strategy = Iro::Strategy.find params[:id] :update, @strategy if @strategy.update params[:strategy].permit! flash_notice @strategy else flash_alert @strategy end redirect_to action: :index end |