Class: Iro::StrategiesController
Instance Method Summary
collapse
#home, #schwab_sync, #schwab_sync_exec
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!
authorize! :create, @strategy
if @strategy.save
flash_notice @strategy
redirect_to action: :index
else
flash_alert @strategy
render action: 'new'
end
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]
authorize! :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]
authorize! :edit, @strategy
end
|
#index ⇒ Object
32
33
34
35
|
# File 'app/controllers/iro/strategies_controller.rb', line 32
def index
authorize! :index, Iro::Strategy
@strategies = Iro::Strategy.all
end
|
#new ⇒ Object
37
38
39
40
|
# File 'app/controllers/iro/strategies_controller.rb', line 37
def new
@strategy = Iro::Strategy.new({ kind: params[:kind] })
authorize! :new, @posision
end
|
#show ⇒ Object
42
43
44
45
|
# File 'app/controllers/iro/strategies_controller.rb', line 42
def show
@strategy = Iro::Strategy.find params[:id]
authorize! :show, @strategy
end
|
#update ⇒ Object
47
48
49
50
51
52
53
54
55
56
57
58
|
# File 'app/controllers/iro/strategies_controller.rb', line 47
def update
@strategy = Iro::Strategy.find params[:id]
authorize! :update, @strategy
if @strategy.update params[:strategy].permit!
flash_notice @strategy
else
flash_alert @strategy
end
redirect_to action: :index
end
|