Class: Iro::AlertsController
Instance Method Summary
collapse
#home, #schwab_sync, #schwab_sync_exec
Instance Method Details
#create ⇒ Object
6
7
8
9
10
11
12
13
14
|
# File 'app/controllers/iro/alerts_controller.rb', line 6
def create
@alert = Iro::Alert.new params[:alert].permit!
authorize! :create, @alert
if @alert.save
redirect_to action: :index, notice: 'Alert was successfully created.'
else
render :new
end
end
|
#destroy ⇒ Object
16
17
18
19
20
21
|
# File 'app/controllers/iro/alerts_controller.rb', line 16
def destroy
@alert = Iro::Alert.find(params[:id])
authorize! :destroy, @alert
@alert.destroy
redirect_to action: :index, notice: 'Alert was successfully destroyed.'
end
|
#index ⇒ Object
23
24
25
26
|
# File 'app/controllers/iro/alerts_controller.rb', line 23
def index
@alerts = Iro::Alert.all
authorize! :index, Iro::Alert
end
|
#update ⇒ Object
28
29
30
31
32
33
34
35
36
37
|
# File 'app/controllers/iro/alerts_controller.rb', line 28
def update
@alert = Iro::Alert.find(params[:id])
authorize! :update, @alert
if @alert.update params[:alert].permit!
flash_notice 'ok'
else
flash_alert @alert
end
redirect_to action: :index, notice: 'Alert was successfully updated.'
end
|