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



43
44
45
46
# File 'app/controllers/admin/roles_controller.rb', line 43

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
40
41
# File 'app/controllers/admin/roles_controller.rb', line 35

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