mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
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.
13 lines
349 B
Ruby
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
|