I would like the user to be able to download the file from the method that I installed in the controller. In addition, I do not want the URL to change in my browser when the user downloads the file. I set this link
<%= link_to image_tag("cc_icon.png"), scenario_download_cc_path(subscription.scenario), target: '_blank' %>
The problem is that a blinking screen appears on the screen when a new tab is created to create a download. It looks visually unattractive. I saw other sites where you click the link, and something starts to load without blinking. How to do it?
Edit: Here is the function called by the link
def download_cc
scenario = Scenario.find(params[:scenario_id])
send_data scenario.cc_data, filename: "#{scenario.title}.imscc", type: 'application/zip', :disposition => 'attachment'
end
user7055375
source
share