So I want to dynamically generate a MIDI file on a web request.Coming from the Java world, I expected something to the tune of
class MidisController < ApplicationController
  before_filter :set_content_type    
  def set_content_type
    @headers["Content-Type"] = "audio/midi; charset=utf-8"
  end
  def show
    midi_data = get_midi_data 
    response.write(midi_data)
  end
But the API says, stay away from the response object. 开发者_高级运维Any ideas ?
Look at the Rails docs for send_file or send_data. It handles all of the header requirements for you.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论