Project

General

Profile

Refactor #15847

URL helpers must be used in mailers

Added by Dominic Cleal about 4 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
E-Mail
Target version:
Difficulty:
Triaged:
Bugzilla link:
Fixed in Releases:
Found in Releases:

Description

#8797 changed mailers from using *_url helpers to *_path, and relied on Roadie's URL rewriting to change them to full URLs. This works reliably and avoids needing to repeat URL options, but it throws deprecation warnings and will not work in Rails 5.

Running host_mailer_test generates warnings such as:

DEPRECATION WARNING: The method `host_path` cannot be used here as a full URL is required. Use `host_url` instead. (called from app_views_host_mailer_link_to_host_html_erb__4138992061028702271_130918480 at /home/dcleal/code/foreman/foreman/app/views/host_mailer/_link_to_host.html.erb:2)

The change could probably be mostly reverted, and default_url_options used in the mailer to avoid the repetition of URL options.


Related issues

Related to Foreman - Refactor #8797: Separate style from the HTML in emails.Closed2014-12-28
Related to Foreman - Refactor #14006: Mailers calling *_path with :only_path => false should use _url helpersClosed2016-03-02

Associated revisions

Revision a9fe14bf (diff)
Added by Dominic Cleal about 4 years ago

fixes #15847 - change mailer helpers from paths to URLs

Use of path helpers in mailers (with Roadie to rewrite to URLs) is
deprecated in Rails 4 and removed in Rails 5, so prefer URL helpers. To
replace URL rewriting and reduce duplication, default_url_options is now
configured. Roadie URL rewriting may still be used for assets.

History

#1 Updated by Dominic Cleal about 4 years ago

  • Related to Refactor #8797: Separate style from the HTML in emails. added

#2 Updated by Dominic Cleal about 4 years ago

  • Related to Refactor #14006: Mailers calling *_path with :only_path => false should use _url helpers added

#3 Updated by The Foreman Bot about 4 years ago

  • Status changed from Assigned to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/3677 added

#4 Updated by Dominic Cleal about 4 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

#5 Updated by Dominic Cleal about 4 years ago

  • Legacy Backlogs Release (now unused) set to 160

Also available in: Atom PDF