method

serve_file

rails latest stable - Class: ActiveStorage::DiskController

Method deprecated or moved

This method is deprecated or moved on the latest stable version. The last existing version (v6.0.0) is shown here.

serve_file(path, content_type:, disposition:)
private

No documentation available.

# File activestorage/app/controllers/active_storage/disk_controller.rb, line 44
    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