ruby variable. can you give me an example. thank you
variable called “data”. i want to create a button to download it as CSV.
So i want the “data”, to be copied in a ruby variable, so i can use the
The send_data function is useful when you have a bunch of data on the
that needs to be streamed to the client.
using send_data means that this data will need to be posted back to the
server, then sent back to the client using send_data. Not very
present it to the user as CSV. Should be relatively quick since the data
already on the client.
I found this function which will create CSV from JSON:
It may not fit your needs exactly, but the relevant line is the
window.open( “data:text/csv;charset=utf-8,” + escape(str))
As long as the str variable contains comma-separated data, this should
browser. Ruby/Rails runs on the server side.
What are you actually trying to accomplish?