Class: RolesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- RolesController
- Defined in:
- app/controllers/roles_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
-
#edit ⇒ Object
修改角色 汤建华.
-
#group_new ⇒ Object
分配权限 汤建华.
-
#index ⇒ Object
角色列表 汤建华.
-
#new ⇒ Object
创建角色 汤建华.
- #update ⇒ Object
Methods inherited from ApplicationController
#check_route, #current_ability, #set_current_user
Instance Method Details
#create ⇒ Object
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 |
#edit ⇒ Object
修改角色汤建华
15 16 |
# File 'app/controllers/roles_controller.rb', line 15 def edit end |
#group_new ⇒ Object
分配权限汤建华
42 43 44 |
# File 'app/controllers/roles_controller.rb', line 42 def group_new @role = Role.find params[:role_id] end |
#index ⇒ Object
角色列表汤建华
5 6 7 |
# File 'app/controllers/roles_controller.rb', line 5 def index @roles = Role.getall end |
#new ⇒ Object
创建角色汤建华
10 11 12 |
# File 'app/controllers/roles_controller.rb', line 10 def new @role = Role.new end |
#update ⇒ Object
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 |