i m working on an app in rails that requires the following :
- Clicking on a button should first download a pdf file (render part) and
- Then redirect to a show page (redirect_to part)
I 've searched the web and found that it is not possible to render and redirect at the same time for a given action , is there any ways around this issue ?
send_datausing render, so you can't do anything after it in your controller.To do this you have to use javascript:
Create a iframe on button click. (That will hold your download process).
Redirect the page on the iframe's close event.
You can also use a background job for download action but I haven't used it yet.