Class: Iro::AlertsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/iro/alerts_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#home

Instance Method Details

#createObject



6
7
8
9
10
11
12
13
# File 'app/controllers/iro/alerts_controller.rb', line 6

def create
  @alert = Iro::Alert.new(alert_params)
  if @alert.save
    redirect_to action: :index, notice: 'Alert was successfully created.'
  else
    render :new
  end
end

#destroyObject



15
16
17
18
19
# File 'app/controllers/iro/alerts_controller.rb', line 15

def destroy
  @alert = Iro::Alert.find(params[:id])
  @alert.destroy
  redirect_to action: :index, notice: 'Alert was successfully destroyed.'
end

#indexObject



21
22
23
# File 'app/controllers/iro/alerts_controller.rb', line 21

def index
  @alerts = Iro::Alert.all
end

#updateObject



25
26
27
28
29
30
31
32
# File 'app/controllers/iro/alerts_controller.rb', line 25

def update
  @alert = Iro::Alert.find(params[:id])
  if @alert.update(alert_params)
    redirect_to action: :index, notice: 'Alert was successfully updated.'
  else
    render :edit
  end
end