• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

sleede / fab-manager / #106

pending completion
#106

push

coveralls-ruby

sylvainbx
Merge branch 'dev' for release 6.0.0

704 of 704 new or added lines in 168 files covered. (100.0%)

7919 of 13474 relevant lines covered (58.77%)

15.29 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/app/controllers/api/supporting_document_files_controller.rb
1
# frozen_string_literal: true
2

3
# API Controller for resources of type SupportingDocumentFile
4
# SupportingDocumentFiles are used in settings
5
class API::SupportingDocumentFilesController < API::APIController
×
6
  before_action :authenticate_user!
×
7
  before_action :set_supporting_document_file, only: %i[show update download]
×
8

9
  def index
×
10
    @supporting_document_files = SupportingDocumentFileService.list(current_user, params)
×
11
  end
×
12

13
  # PUT /api/supporting_document_files/1/
14
  def update
×
15
    authorize @supporting_document_file
×
16
    if SupportingDocumentFileService.update(@supporting_document_file, supporting_document_file_params)
×
17
      render :show, status: :ok, location: @supporting_document_file
×
18
    else
×
19
      render json: @supporting_document_file.errors, status: :unprocessable_entity
×
20
    end
×
21
  end
×
22

23
  # POST /api/supporting_document_files/
24
  def create
×
25
    @supporting_document_file = SupportingDocumentFile.new(supporting_document_file_params)
×
26
    authorize @supporting_document_file
×
27
    if SupportingDocumentFileService.create(@supporting_document_file)
×
28
      render :show, status: :created, location: @supporting_document_file
×
29
    else
×
30
      render json: @supporting_document_file.errors, status: :unprocessable_entity
×
31
    end
×
32
  end
×
33

34
  # GET /api/supporting_document_files/1/download
35
  def download
×
36
    authorize @supporting_document_file
×
37
    send_file @supporting_document_file.attachment.url, type: @supporting_document_file.attachment.content_type, disposition: 'attachment'
×
38
  end
×
39

40
  # GET /api/supporting_document_files/1/
41
  def show; end
×
42

43
  private
×
44

45
  def set_supporting_document_file
×
46
    @supporting_document_file = SupportingDocumentFile.find(params[:id])
×
47
  end
×
48

49
  # Never trust parameters from the scary internet, only allow the white list through.
50
  def supporting_document_file_params
×
51
    params.required(:supporting_document_file).permit(:supporting_document_type_id, :attachment, :user_id)
×
52
  end
×
53
end
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc