Class: Dust::RolesController

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

Instance Method Summary collapse

Methods inherited from AuthenticationController

#not_authenticated, #permission_denied, #try_return_to_previous_page

Instance Method Details

#createObject



16
17
18
19
20
21
22
23
24
# File 'app/controllers/dust/roles_controller.rb', line 16

def create
  @role = Dust::Role.new(params[:dust_role])
  if @role.save
    flash[:notice] = "Successfully created role."
    redirect_to dust_roles_url
  else
    render :action => 'new', :layout => 'cms'
  end
end

#destroyObject



40
41
42
43
44
45
# File 'app/controllers/dust/roles_controller.rb', line 40

def destroy
  @role = Dust::Role.find(params[:id])
  @role.destroy
  flash[:notice] = "Successfully destroyed role."
  redirect_to dust_roles_url
end

#editObject



26
27
28
# File 'app/controllers/dust/roles_controller.rb', line 26

def edit
  @role = Dust::Role.find(params[:id])
end

#indexObject



8
9
10
# File 'app/controllers/dust/roles_controller.rb', line 8

def index
  @roles = Dust::Role.all
end

#newObject



12
13
14
# File 'app/controllers/dust/roles_controller.rb', line 12

def new
  @role = Dust::Role.new
end

#updateObject



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

def update
  @role = Dust::Role.find(params[:id])
  if @role.update_attributes(params[:dust_role])
    flash[:notice] = "Successfully updated role."
    redirect_to dust_roles_url
  else
    render :action => 'edit', :layout => 'cms'
  end
end