Class: IshManager::IroStrategiesController
Instance Method Summary
collapse
#basic_auth, #home, #tinymce
Instance Method Details
#create ⇒ Object
4
5
6
7
8
9
10
11
12
13
14
15
16
|
# File 'app/controllers/ish_manager/iro_strategies_controller.rb', line 4
def create
@strategy = Iro::CoveredCallStrategy.new params[:iro_strategy].permit!
authorize! :create, @strategy
flag = @strategy.save
if flag
flash[:notice] = 'Success.'
redirect_to controller: 'ish_manager/iro_purses', action: :show, id: @strategy.iro_purse_id
else
flash[:alert] = "No luck: #{@strategy.errors.full_messages.join(', ')}."
render action: 'new'
end
end
|
#edit ⇒ Object
18
19
20
21
|
# File 'app/controllers/ish_manager/iro_strategies_controller.rb', line 18
def edit
@strategy = Iro::CoveredCallStrategy.find params[:id]
authorize! :edit, @strategy
end
|
#new ⇒ Object
23
24
25
26
|
# File 'app/controllers/ish_manager/iro_strategies_controller.rb', line 23
def new
@strategy = Iro::CoveredCallStrategy.new
authorize! :new, @strategy
end
|
#update ⇒ Object
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'app/controllers/ish_manager/iro_strategies_controller.rb', line 28
def update
@strategy = Iro::CoveredCallStrategy.find params[:id]
authorize! :update, @strategy
flag = @strategy.update params[:iro_strategy].permit!
if flag
flash[:notice] = 'Success.'
redirect_to controller: 'ish_manager/iro_purses', action: :show, id: @strategy.iro_purse_id
else
flash[:alert] = "No luck: #{@strategy.errors.full_messages.join(', ')}."
render action: 'new'
end
end
|