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
This piece of code was introduced on
67d8bb963d , which was calling
`committed?` in the `transaction_state` before calling the `committed!`
method. However on 7386ffc781, the
`committed?` check was removed and replaced by a `finalized?`, which
only checks if the state is not nil. Thus we can remove that line.
Closes#16163
Adding attachments after a call to `mail` will result in invalid emails.
This is related to the fact, that `mail` is making the required preparations
before the email is ready to be sent. These change depending on your
added attachments.
`Time#as_json`, `Date#as_json` and `DateTime#as_json` incorrectly depends on a
delegation that is set up in `active_support/json/encoding`. We cannot simply
require that file in `core_ext/object/json` because it would cause a circular
dependency problem (see #12203 for background). We should instead rely on AS's
autoload to load that file for us on-demand.
To trigger autoload correctly, we need to reference the `AS::JSON::Encoding`
constant instead of using the delegated version.
Fixes#16131.
When passing a class constant as a job argument, Que’s stored procedures serialize it to JSON in the database as `{}`. This means that when the job (the ActiveJob “wrapper”) is deserialized from the database, it can’t find the original job class to run again.
Changing the Que adapter to serialize the job class as a string fixes this behaviour. This change makes the adapter consistent with other adapters too (which constantize a class string in their JobWrapper#perform methods.