mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
2bbcca004c
Email does not support relative links since there is no implicit host. Therefore all links inside of emails must be fully qualified URLs. All path helpers are now deprecated. When removed, the error will give early indication to developers to use `*_url` methods instead. Currently if a developer uses a `*_path` helper, their tests and `mail_view` will not catch the mistake. The only way to see the error is by sending emails in production. Preventing sending out emails with non-working path's is the desired end goal of this PR. Currently path helpers are mixed-in to controllers (the ActionMailer::Base acts as a controller). All `*_url` and `*_path` helpers are made available through the same module. This PR separates this behavior into two modules so we can extend the `*_path` methods to add a Deprecation to them. Once deprecated we can use this same area to raise a NoMethodError and add an informative message directing the developer to use `*_url` instead. The module with warnings is only mixed in when a controller returns false from the newly added `supports_relative_path?`. Paired @sgrif & @schneems
913 B
913 B
-
Deprecate
*_path
helpers in email views. When used they generate non-working links and are not the intention of most developers. Instead we recommend to use*_url
helper.Richard Schneeman
-
Raise an exception when attachments are added after
mail
was called. This is a safeguard to prevent invalid emails.Fixes #16163.
Yves Senn
-
Add
config.action_mailer.show_previews
configuration option.This config option can be used to enable the mail preview in environments other than development (such as staging).
Defaults to
true
in development and false elsewhere.Leonard Garvey
-
Allow preview interceptors to be registered through
config.action_mailer.preview_interceptors
.See #15739.
Yves Senn
Please check 4-1-stable for previous changes.