instance method serve_file

Ruby on Rails 5.2.8.1

Since v5.2.8.1 Last seen in v6.0.6 Private

Available in: v5.2.8.1 v6.0.6

Signature

serve_file(path, content_type:, disposition:)

No documentation comment.

Parameters

path req
content_type keyreq
disposition keyreq
Source
# File activestorage/app/controllers/active_storage/disk_controller.rb, line 41
    def serve_file(path, content_type:, disposition:)
      Rack::File.new(nil).serving(request, path).tap do |(status, headers, body)|
        self.status = status
        self.response_body = body

        headers.each do |name, value|
          response.headers[name] = value
        end

        response.headers["Content-Type"] = content_type || DEFAULT_SEND_FILE_TYPE
        response.headers["Content-Disposition"] = disposition || DEFAULT_SEND_FILE_DISPOSITION
      end
    end

Defined in activestorage/app/controllers/active_storage/disk_controller.rb line 41 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveStorage::DiskController

Type at least 2 characters to search.

↑↓ navigate · open · esc close