We were duplicating the asset host and the URL host in all environments, but we can make it so the asset host uses the URL host unless we specifically set it. Note that, inside the `ApplicationMailer`, the `root_url` method already uses `default_url_options` to generate the URL. In the rare case of CONSUL installations who have changed the asset host, this change has no effect since they'll get a conflict in the environment files when upgrading and they'll choose to use their own asset host.
13 lines
331 B
Ruby
13 lines
331 B
Ruby
class ApplicationMailer < ActionMailer::Base
|
|
helper :settings
|
|
helper :application
|
|
helper :mailer
|
|
default from: proc { "#{Setting["mailer_from_name"]} <#{Setting["mailer_from_address"]}>" }
|
|
layout "mailer"
|
|
before_action :set_asset_host
|
|
|
|
def set_asset_host
|
|
self.asset_host ||= root_url.delete_suffix("/")
|
|
end
|
|
end
|