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 |
# 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 37 |
# File 'app/controllers/iro/strategies_controller.rb', line 32 def index :index, Iro::Strategy @strategies = Iro::Strategy.all # render '_table' end |
#new ⇒ Object
39 40 41 42 |
# File 'app/controllers/iro/strategies_controller.rb', line 39 def new @strategy = Iro::Strategy.new :new, @posision end |
#show ⇒ Object
44 45 46 47 |
# File 'app/controllers/iro/strategies_controller.rb', line 44 def show @strategy = Iro::Strategy.find params[:id] :show, @strategy end |
#update ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'app/controllers/iro/strategies_controller.rb', line 51 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 |