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

def create
  @role = SpudRole.new(params[:spud_role])
  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



29
30
31
# File 'app/controllers/admin/roles_controller.rb', line 29

def edit
  respond_with @role
end

#indexObject



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

def index
  @roles = SpudRole.all
  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



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

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