rails/rails — Issue #3642: Guides: Action Mailer Basics has depricated calls
Author: arkadiyk
Created: 2011-11-16 03:21:35+00:00
State: open

In the *Generating URLs in Action Mailer Views* section of http://guides.rubyonrails.org/action_mailer_basics.html#generating-urls-in-action-mailer-views
the last paragraph is outdated. Probably it should be replaced from the one from http://api.rubyonrails.org/classes/ActionMailer/Base.html (pasted below)

It is also possible to set a default host that will be used in all mailers by setting the :host option as a configuration option in config/application.rb:

config.action_mailer.default_url_options = { :host => "example.com" }

Setting ActionMailer::Base.default_url_options directly is now deprecated, use the configuration option mentioned above to set the default host.

If you do decide to set a default :host for your mailers you want to use the :only_path => false option when using url_for. This will ensure that absolute URLs are generated because the url_for view helper will, by default, generate relative URLs when a :host option isn’t explicitly provided.