In my background worker I'm creating a pdf and saving it to the tmp directory with:
save_path = Rails.root.join('tmp', unique_report_name)
File.open(save_path, 'wb') do |file|
file << pdf
end
I then try to open the pdf in a new window and get ActionController::RoutingError (No route matches [GET] errors.
I've tried copying what they do with CarrierWave (I'm not using CarrierWave) by using the below in config.ru:
use Rack::Static, :urls => ['/tmp'], :root => 'tmp'
but I get the error File not found: /tmp/my_file_name.pdf even though the file does indeed exist in the location.
You should be able to reach that file using Rails.root
"#{Rails.root}/tmp/my_file_name.pdf"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With