blob: a982857c0b66e7a5b1c96b2ca97243e05e2ed862 (
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
48
49
50
51
|
class AdminPublicBodyController < ApplicationController
def index
list
render :action => 'list'
end
# GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
verify :method => :post, :only => [ :destroy, :create, :update ],
:redirect_to => { :action => :list }
def list
@public_body_pages, @public_bodies = paginate :public_bodies, :per_page => 10
end
def show
@public_body = PublicBody.find(params[:id])
end
def new
@public_body = PublicBody.new
end
def create
@public_body = PublicBody.new(params[:public_body])
if @public_body.save
flash[:notice] = 'PublicBody was successfully created.'
redirect_to :action => 'list'
else
render :action => 'new'
end
end
def edit
@public_body = PublicBody.find(params[:id])
end
def update
@public_body = PublicBody.find(params[:id])
if @public_body.update_attributes(params[:public_body])
flash[:notice] = 'PublicBody was successfully updated.'
redirect_to :action => 'show', :id => @public_body
else
render :action => 'edit'
end
end
def destroy
PublicBody.find(params[:id]).destroy
redirect_to :action => 'list'
end
end
|