开发者

Rails 3 file download wizard

I wrote an app that takes you through a 2 step wizard - one page collects information, the other is an agreement. When you click Agree the page loads a "Downloading this file..." page, and then should start actually downloading the file, overall 开发者_如何学Goa pretty common task. However, I'm struggling with a solution in Rails. Ideally I would think to just render the "Downloading page..." and then make a call to send_file, but you can't do this as it results in a DoulbeRender error.

What is a good way to load a page and then subsequently initiate a file download in Rails?


You want to render the download page, and then send the user to a separate action which sends your file. Generally this is accomplished with a meta tag, see Trigger file download on a page with content for a PHP example.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜