Creating a tar file for download

Hello,

I have an action on my controller named download which creates a tar
file and then sends the file (via send_file) to the user. Its working
but I will like to delete the file once it is sent. The tar file
should be temporary and only available for download and then deleted
from the server. Any idea on how to do this?
Thanks,

def download
@app = App.find params[:id]
system('cd ‘[email protected]+’ && tar -cf ‘[email protected]+’.tar
')
send_file $global_path+"#{@app.name}/#{@app.name}.tar"
end

Basically I just want to be able to delete the file one it is
download. Any ideas?