Created
December 2, 2011 01:08
-
-
Save sudodo/1421152 to your computer and use it in GitHub Desktop.
create and send file dynamically by rails
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyController < ApplicationController | |
def get_text | |
data = "generated by rails controller" | |
send_data(data, :filename => "rails_generated.txt", :type => "text/plain") | |
#send_file 'evidence_tmp/tmp.zip', :type => "application/zip" # => when the file already exists. | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment