1 # Hack ActionController::DataStreaming to allow streaming from a file handle
2 module ActionController
4 alias_method :old_send_file, :send_file
6 def send_file(file, options = {})
7 if file.is_a? File or file.is_a? Tempfile
8 options[:filename] ||= File.basename(file.path) unless options[:url_based_filename]
9 send_file_headers! options
11 self.status = options[:status] || 200
12 self.content_type = options[:content_type] if options.key?(:content_type)
13 self.response_body = file
15 old_send_file(file, options)