Class: Admin::RolesController

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

Instance Method Summary collapse

Instance Method Details

#createObject



23
24
25
26
27
28
29
# File 'app/controllers/admin/roles_controller.rb', line 23

def create
  logger.debug 'role_params:'
  logger.debug role_params
  @role = SpudRole.new(role_params)
  flash[:notice] = 'SpudRole created successfully' if @role.save
  respond_with @role, location: admin_roles_path
end

#destroyObject



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

def destroy
  flash[:notice] = 'SpudRole deleted successfully' if @role.destroy
  respond_with @role, location: admin_roles_path
end

#editObject



31
32
33
# File 'app/controllers/admin/roles_controller.rb', line 31

def edit
  respond_with @role
end

#indexObject



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

def index
  @roles = SpudRole.includes(:spud_role_permissions)
  respond_with @roles
end

#newObject



18
19
20
21
# File 'app/controllers/admin/roles_controller.rb', line 18

def new
  @role = SpudRole.new
  respond_with @role
end

#showObject



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

def show
  respond_with @role
end

#updateObject



35
36
37
38
39
# File 'app/controllers/admin/roles_controller.rb', line 35

def update
  #role_params[:permission_tags] ||= []
  flash[:notice] = 'SpudRole updated successfully' if @role.update(role_params)
  respond_with @role, location: admin_roles_path
end