Class: ScapContentsController

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

Instance Method Summary collapse

Instance Method Details

#createObject



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

def create
  @scap_content = ForemanOpenscap::ScapContent.new(scap_content_params)
  if @scap_content.save
    process_success
  else
    process_error
  end
end

#destroyObject



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

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

#indexObject



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

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

#model_of_controllerObject



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

def model_of_controller
  ::ForemanOpenscap::ScapContent
end

#newObject



22
23
24
# File 'app/controllers/scap_contents_controller.rb', line 22

def new
  @scap_content = ForemanOpenscap::ScapContent.new
end

#showObject



16
17
18
19
20
# File 'app/controllers/scap_contents_controller.rb', line 16

def show
  send_data @scap_content.scap_file,
            :type     => 'application/xml',
            :filename => @scap_content.original_filename
end

#updateObject



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

def update
  if @scap_content.update(scap_content_params)
    process_success
  else
    process_error
  end
end