Class: Iro::StrategiesController
- Inherits:
-
ApplicationController
- Object
- Wco::ApplicationController
- ApplicationController
- Iro::StrategiesController
- Defined in:
- app/controllers/iro/strategies_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 16 17 |
# File 'app/controllers/iro/strategies_controller.rb', line 6 def create @strategy = Iro::Strategy.new params[:strategy].permit! :create, @strategy if @strategy.save flash_notice @strategy else flash_alert @strategy end redirect_to action: :index end |
#destroy ⇒ Object
19 20 21 22 23 24 25 |
# File 'app/controllers/iro/strategies_controller.rb', line 19 def destroy @strategy = Iro::Strategy.find params[:id] :destroy, @strategy @strategy.delete flash_notice "Probably ok" redirect_to request.referrer end |
#edit ⇒ Object
27 28 29 30 |
# File 'app/controllers/iro/strategies_controller.rb', line 27 def edit @strategy = Iro::Strategy.find params[:id] :edit, @strategy end |
#index ⇒ Object
32 33 34 35 36 |
# File 'app/controllers/iro/strategies_controller.rb', line 32 def index :index, Iro::Strategy @strategies = Iro::Strategy.all # render '_table' end |
#new ⇒ Object
38 39 40 41 |
# File 'app/controllers/iro/strategies_controller.rb', line 38 def new @strategy = Iro::Strategy.new :new, @posision end |
#update ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'app/controllers/iro/strategies_controller.rb', line 43 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 |