Class: UsergroupsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/usergroups_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#api_request?, #welcome

Methods included from Foreman::ThreadSession::Cleaner

#clear_thread, included

Instance Method Details

#createObject


14
15
16
17
18
19
20
21
# File 'app/controllers/usergroups_controller.rb', line 14

def create
  @usergroup = Usergroup.new(params[:usergroup])
  if @usergroup.save
    process_success
  else
    process_error
  end
end

#destroyObject


36
37
38
39
40
41
42
43
# File 'app/controllers/usergroups_controller.rb', line 36

def destroy
  @usergroup = Usergroup.find(params[:id])
  if @usergroup.destroy
    process_success
  else
    process_error
  end
end

#editObject


23
24
25
# File 'app/controllers/usergroups_controller.rb', line 23

def edit
  @usergroup = Usergroup.find(params[:id])
end

#indexObject


2
3
4
5
6
7
8
# File 'app/controllers/usergroups_controller.rb', line 2

def index
  @usergroups = Usergroup.paginate :page => params[:page]
  respond_to do |format|
    format.html
    format.json { render :json => @usergroups}
  end
end

#newObject


10
11
12
# File 'app/controllers/usergroups_controller.rb', line 10

def new
  @usergroup = Usergroup.new
end

#updateObject


27
28
29
30
31
32
33
34
# File 'app/controllers/usergroups_controller.rb', line 27

def update
  @usergroup = Usergroup.find(params[:id])
  if @usergroup.update_attributes(params[:usergroup])
    process_success
  else
    process_error
  end
end