i have to generate a text file when clicked on a button and when this
file got generated than i have to show a download dialog box so that
user can download this text file on his computer, can any body gives any
snippet of code or any idea how can i add this download functionality.
Hello friend,
Thanks for your help but it is not working for me , instead of the
download dialog box its just showing me the content of the text file.
can u give me any idea why this is happening… ?
Hello friend,
Thanks for your help but it is not working for me , instead of thedownloaddialogbox its just showing me the content of the text file.
can u give me any idea why this is happening… ?
You can also use send_data(). Instead of generating the output and
then writing it to a file and then attempting to send that file, you
can just generate the output and send it, skipping the file part:
data = “A String you generated somehow”
send_data( data, :filename => ‘filename.txt’ )
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.