Class: Admin::PlatePurposesController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/admin/plate_purposes_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject


37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'app/controllers/admin/plate_purposes_controller.rb', line 37

def create
  @plate_purpose = PlatePurpose.new(params[:plate_purpose])

  respond_to do |format|
    if @plate_purpose.save
      flash[:notice] = 'Plate Purpose was successfully created.'
      format.html { redirect_to(admin_plate_purposes_path) }
      format.xml  { render xml: @plate_purpose, status: :created, location: @plate_purpose }
    else
      format.html { render action: 'new' }
      format.xml  { render xml: @plate_purpose.errors, status: :unprocessable_entity }
    end
  end
end

#destroyObject


65
66
67
68
69
70
71
72
# File 'app/controllers/admin/plate_purposes_controller.rb', line 65

def destroy
  @plate_purpose.destroy

  respond_to do |format|
    format.html { redirect_to(admin_plate_purposes_url) }
    format.xml  { head :ok }
  end
end

#editObject


34
35
# File 'app/controllers/admin/plate_purposes_controller.rb', line 34

def edit
end

#indexObject


8
9
10
11
12
13
14
15
16
# File 'app/controllers/admin/plate_purposes_controller.rb', line 8

def index
  plate_purposes = PlatePurpose.all
  @plate_purposes = plate_purposes.map { |purpose| purpose.becomes(PlatePurpose) }

  respond_to do |format|
    format.html
    format.xml { render xml: @plate_purposes }
  end
end

#newObject


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

def new
  @plate_purpose = PlatePurpose.new

  respond_to do |format|
    format.html
    format.xml { render xml: @plate_purpose }
  end
end

#showObject


18
19
20
21
22
23
# File 'app/controllers/admin/plate_purposes_controller.rb', line 18

def show
  respond_to do |format|
    format.html
    format.xml { render xml: @plate_purpose }
  end
end

#updateObject


52
53
54
55
56
57
58
59
60
61
62
63
# File 'app/controllers/admin/plate_purposes_controller.rb', line 52

def update
  respond_to do |format|
    if @plate_purpose.update(params[:plate_purpose])
      flash[:notice] = 'Plate Purpose was successfully updated.'
      format.html { redirect_to(admin_plate_purposes_path) }
      format.xml  { head :ok }
    else
      format.html { render action: 'edit' }
      format.xml  { render xml: @plate_purpose.errors, status: :unprocessable_entity }
    end
  end
end