I am using rails4 and in my controller page I have xl download like below.
Everything works fine but when I use the browser's back and forward buttons, it is downloading the same content again and again. How can ? get rid of it?
def download_report
@acquisitions = AcquisitionReport.generate(params[:acquisition_id].to_i, params[:portfolio_id])
cookies[:fileDownload] = 'true'
render xlsx: 'download_report',filename: "report.xlsx"
end
i think, You have to maintain sessions
def download_report
@acquisitions = AcquisitionReport.generate(params[:acquisition_id].to_i, params[:portfolio_id])
if session[:test] == true
session[:test] = nil
render xlsx: 'download_report',filename: "report.xlsx"
else
render :nothing => true, :status => 200, :content_type => 'text/html'
end
end