Class: TailoringFilesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- TailoringFilesController
- Includes:
- Foreman::Controller::AutoCompleteSearch, Foreman::Controller::Parameters::TailoringFile
- Defined in:
- app/controllers/tailoring_files_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #model_of_controller ⇒ Object
- #new ⇒ Object
- #update ⇒ Object
- #xml ⇒ Object
Instance Method Details
#create ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 |
# 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 rescue RestClient::Exception => e @tailoring_file.errors.add(:scap_file, :invalid, message: e.http_body) process_error end |
#destroy ⇒ Object
43 44 45 46 47 48 49 |
# File 'app/controllers/tailoring_files_controller.rb', line 43 def destroy if @tailoring_file.destroy process_success else process_error :object => @tailoring_file end end |
#edit ⇒ Object
32 33 |
# File 'app/controllers/tailoring_files_controller.rb', line 32 def edit end |
#index ⇒ Object
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_controller ⇒ Object
8 9 10 |
# File 'app/controllers/tailoring_files_controller.rb', line 8 def model_of_controller ::ForemanOpenscap::TailoringFile end |
#new ⇒ Object
16 17 18 |
# File 'app/controllers/tailoring_files_controller.rb', line 16 def new @tailoring_file = ::ForemanOpenscap::TailoringFile.new end |
#update ⇒ Object
35 36 37 38 39 40 41 |
# File 'app/controllers/tailoring_files_controller.rb', line 35 def update if @tailoring_file.update(tailoring_file_params) process_success else process_error end end |
#xml ⇒ Object
51 52 53 54 55 |
# File 'app/controllers/tailoring_files_controller.rb', line 51 def xml send_data @tailoring_file.scap_file, :type => 'application/xml', :filename => @tailoring_file.original_filename || "#{@tailoring_file.name}.xml" end |