mercredi 9 mars 2016

How to delete files after pdf window close: Rails 3, wicked_pdf

community!
I have my Rails 3 app with a task to delete .png files, that are included in the .pdf file, after the rendered pdf window close.
The pdf render code goes like this:
<%= wicked_pdf_image_tag("/public/#{@current_user.username}/picture1.png") %>,
and the last line is
<% FileUtils.rm_r Dir.glob("./public/#{@current_user.username}/*") %>

With such conditions my picture is not being rendered. I need the second command to be triggered after the pdf window close.

Maybe You have some other solution to solve this task.

Aucun commentaire:

Enregistrer un commentaire