Reputation: 2261
I have a variable recs
that stores the data I want to pass.
I want to have something like send_data
as a button, so that I will not have to store an extra file somewhere. When a user clicks on the button, the send_data will send recs
to the browser.
send_data(recs, :filename => "query.txt")
However, I was not able to find the representation of the send_data as a button.
Upvotes: 0
Views: 395
Reputation: 2460
Define an action in your controller in which send_data
executes. and add the respective route to your routes.rb
. Then put a link_to
this defined action in your view with required css class to show it as a button.
Upvotes: 2