ankane / ahoy_email

First-party email analytics for Rails
MIT License
1.11k stars 137 forks source link

Preserve default_url_options overrides in the mailer class #152

Closed bcroesch closed 3 years ago

bcroesch commented 3 years ago

We override default_url_options in our mailers so that we can have dynamic hosts in the mailer's URLs. Roughly something like:

class MyMailer < ActionMailer::Base

  def default_url_options
    { host: "#{some_dynamic_subdomain}.example.com" }
  end

end

Going directly through ActionMailer::Base.default_url_options circumvents that override. This change will preserve it, but also should fall back to ActionMailer::Base.default_url_options if no override exists.

ankane commented 3 years ago

Great, thanks @bcroesch!