title: In Ruby on Rails, After send_file method delete the file from server
body: <p>I am using following code for sending the file in Rails.</p>
  
  <pre>
  if File.exist?(file_path)
    send_file(file_path, type: 'text/excel') 
    File.delete(file_path)
  end
  </pre>
  
  <p>In this I am trying to send the file and delete the file from server once it is been send successfully. But I am facing issue is, the delete operation is getting executed while sending is performing and due to that I don't see anything in browser.</p>
  
  <p>So is there any way in Rails, once the send_file operation is completed delete the file from server.</p>
  
  <p>Any help on this would be highly appreciated.</p>
  
  <p>
  Thanks,<br />
  Chetan
  </p>