Class: RolesController

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

Instance Method Summary collapse

Methods inherited from ApplicationController

#check_route, #current_ability, #set_current_user

Instance Method Details

#createObject



18
19
20
21
22
23
24
25
26
27
# File 'app/controllers/roles_controller.rb', line 18

def create
  @role = Role.new(role_params)
  respond_to do |format|
    if @role.save
      format.html { redirect_to role_group_new_path(@role) }
    else
      format.html { render new_role_path, :alert => @role.errors.values.join(";") }
    end
  end
end

#editObject

修改角色汤建华



15
16
# File 'app/controllers/roles_controller.rb', line 15

def edit
end

#group_newObject

分配权限汤建华



42
43
44
# File 'app/controllers/roles_controller.rb', line 42

def group_new
  @role = Role.find params[:role_id]
end

#indexObject

角色列表汤建华



5
6
7
# File 'app/controllers/roles_controller.rb', line 5

def index
  @roles = Role.getall
end

#newObject

创建角色汤建华



10
11
12
# File 'app/controllers/roles_controller.rb', line 10

def new
  @role = Role.new
end

#updateObject



29
30
31
32
33
34
35
36
37
38
# File 'app/controllers/roles_controller.rb', line 29

def update
  respond_to do |format|
    if @role.update(role_params)
      format.html { redirect_to roles_path }
    else
      msg = @role.errors.values.join(";")
      format.html { redirect_to edit_role_path, :alert => msg }
    end
  end
end