Class: PtablesController

Inherits:
ApplicationController show all
Includes:
Foreman::Controller::AutoCompleteSearch
Defined in:
app/controllers/ptables_controller.rb

Instance Method Summary collapse

Methods included from Foreman::Controller::AutoCompleteSearch

#auto_complete_search, #invalid_search_query

Methods inherited from ApplicationController

#api_request?, #welcome

Methods included from Foreman::ThreadSession::Cleaner

#clear_thread, included

Instance Method Details

#createObject


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

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

#destroyObject


43
44
45
46
47
48
49
# File 'app/controllers/ptables_controller.rb', line 43

def destroy
  if @ptable.destroy
    process_success
  else
    process_error
  end
end

#editObject


32
33
# File 'app/controllers/ptables_controller.rb', line 32

def edit
end

#indexObject


5
6
7
8
9
10
11
# File 'app/controllers/ptables_controller.rb', line 5

def index
  values = Ptable.search_for(params[:search], :order => params[:order])
  respond_to do |format|
    format.html { @ptables = values.paginate :page => params[:page], :include => [:operatingsystems] }
    format.json { render :json => values }
  end
end

#newObject


19
20
21
# File 'app/controllers/ptables_controller.rb', line 19

def new
  @ptable = Ptable.new
end

#showObject


13
14
15
16
17
# File 'app/controllers/ptables_controller.rb', line 13

def show
  respond_to do |format|
    format.json { render :json => @ptable }
  end
end

#updateObject


35
36
37
38
39
40
41
# File 'app/controllers/ptables_controller.rb', line 35

def update
  if @ptable.update_attributes(params[:ptable])
    process_success
  else
    process_error
  end
end