Files
openfoodnetwork/app/mailers/report_mailer.rb
Maikel Linke 860fe85af9 Add report download link to email notification
I added a system spec to verify that the download link can be generated
within the mailer in a background job. ActiveStorage is a bit particular
when it comes to genererating URLs and depending on the situation it may
generate a redirect URL, a proxy URL or link directly to the storage.
But we want a redirect URL here.
2023-05-15 19:41:45 +02:00

13 lines
349 B
Ruby

# frozen_string_literal: true
class ReportMailer < ApplicationMailer
def report_ready
# When we are in a background job then we don't have an HTTP request object
# and we need to tell ActiveStorage the hostname to generate URLs.
ActiveStorage::Current.url_options ||= url_options
@blob = params[:blob]
mail(params)
end
end