Class: TailoringFilesController

Inherits:
ApplicationController
  • Object
show all
Includes:
Foreman::Controller::AutoCompleteSearch, Foreman::Controller::Parameters::TailoringFile
Defined in:
app/controllers/tailoring_files_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



20
21
22
23
24
25
26
27
# File 'app/controllers/tailoring_files_controller.rb', line 20

def create
  @tailoring_file = ForemanOpenscap::TailoringFile.new(tailoring_file_params)
  if @tailoring_file.save
    process_success
  else
    process_error
  end
end

#destroyObject



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

def destroy
  if @tailoring_file.destroy
    process_success
  else
    process_error :object => @tailoring_file
  end
end

#editObject



29
30
# File 'app/controllers/tailoring_files_controller.rb', line 29

def edit
end

#indexObject



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

def index
  @tailoring_files = resource_base_search_and_page.search_for(params[:search])
end

#model_of_controllerObject



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

def model_of_controller
  ::ForemanOpenscap::TailoringFile
end

#newObject



16
17
18
# File 'app/controllers/tailoring_files_controller.rb', line 16

def new
  @tailoring_file = ::ForemanOpenscap::TailoringFile.new
end

#updateObject



32
33
34
35
36
37
38
# File 'app/controllers/tailoring_files_controller.rb', line 32

def update
  if @tailoring_file.update_attributes(tailoring_file_params)
    process_success
  else
    process_error
  end
end

#xmlObject



48
49
50
51
52
# File 'app/controllers/tailoring_files_controller.rb', line 48

def xml
  send_data @tailoring_file.scap_file,
            :type     => 'application/xml',
            :filename => @tailoring_file.original_filename || "#{@tailoring_file.name}.xml"
end