summaryrefslogtreecommitdiff
path: root/app/controllers/intruders_controller.rb
blob: 708e11a7f7d7f92ea0124b65a7ec64e8f8e1efc3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
class IntrudersController < ApplicationController
  def index
    @intruders = Intruder.all
  end

  def show
    @intruder = Intruder.find(params[:id])
    if ! params[:whois].blank?
      @whois = @intruder.whois(params[:whois])
      if @whois.blank?
        @whois = 'no information'
      end
    end
  end

  def new
    @intruder = Intruder.new
  end

  def create
    @intruder = Intruder.new(params[:intruder])
    if @intruder.save
      redirect_to @intruder, :notice => t('intruders.controller.successfuly_created')
    else
      render :new
    end
  end

  def edit
    @intruder = Intruder.find(params[:id])
  end

  def update
    @intruder = Intruder.find(params[:id])
    if @intruder.update_attributes(params[:intruder])
      redirect_to @intruder, :notice  => t('intruders.controller.successfuly_updated')
    else
      render :edit
    end
  end

  def destroy
    @intruder = Intruder.find(params[:id])
    @intruder.destroy
    redirect_to intruders_url, :notice => t('intruders.controller.successfuly_destroyed')
  end
end