Class: IshManager::IroPositionsController
Instance Method Summary
collapse
#basic_auth, #home, #tinymce
Instance Method Details
#create ⇒ Object
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
# File 'app/controllers/ish_manager/iro_positions_controller.rb', line 6
def create
@position = Iro::Position.new({
type: 'Iro::CoveredCall',
})
authorize! :update, @position
if @position.update params[:iro_position].permit!
flash[:notice] = 'Successfully updated position.'
redirect_to controller: 'iro_purses', action: :show, id: params[:iro_position][:iro_purse_id]
else
flash[:alert] = "Cannot update position: #{@position.errors.full_messages.join(', ')}."
render action: 'edit'
end
end
|
#edit ⇒ Object
21
22
23
24
|
# File 'app/controllers/ish_manager/iro_positions_controller.rb', line 21
def edit
@position = Iro::Position.find params[:id]
authorize! :edit, @position
end
|
#new ⇒ Object
26
27
28
29
|
# File 'app/controllers/ish_manager/iro_positions_controller.rb', line 26
def new
@position = Iro::Position.new
authorize! :new, @position
end
|
#update ⇒ Object
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'app/controllers/ish_manager/iro_positions_controller.rb', line 31
def update
@position = Iro::Position.find params[:id]
authorize! :update, @position
if @position.update params[:iro_position].permit!
flash[:notice] = 'Successfully updated position.'
redirect_to controller: 'iro_purses', action: :show, id: @position[:iro_purse_id]
else
flash[:alert] = "Cannot update position: #{@position.errors.full_messages.join(', ')}."
render action: 'edit'
end
end
|