role_controller.rb
929 Bytes
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 RoleController < EnvironmentAdminController
def index
@roles = Role.find(:all)
end
def show
@role = Role.find(params[:id])
end
def new
@role = Role.new
end
def create
@role = Role.new(params[:role])
if @role.save
redirect_to :action => 'show', :id => @role
else
flash[:notice] = _('Failed to create role')
render :action => 'new'
end
end
def edit
@role = Role.find(params[:id])
end
def update
@role = Role.find(params[:id])
if @role.update_attributes(params[:role])
redirect_to :action => 'show', :id => @role
else
flash[:notice] = _('Failed to edit role')
render :action => 'edit'
end
end
def destroy
@role = Role.find(params[:id])
if @role.destroy
redirect_to :action => 'index'
else
flash[:notice] = _('Failed to edit role')
redirect_to :action => 'index'
end
end
end