写出一个自定义的文件从一个轨道控制器动作

问题描述:

所以我要动态地生成从Java世界网络request.Coming MIDI文件的响应,我期望的东西的调写出一个自定义的文件从一个轨道控制器动作

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 

但API说,远离响应对象。有任何想法吗 ?

查看send_file或send_data的Rails文档。它处理你的所有头文件需求。