This project is archived and is in readonly mode.
ActionMailer::Base.default_url_options are not actually deprecated
-
David Trasbo
- State changed from new to invalid
- Importance changed from to Low
Yes,
default_url_optionsis not deprecated. Quoting the docs: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.
Setting
default_url_optionsthroughActionMailer::Basedirectly is deprecated. Doing it through the standardconfigobject is not. -
ara.t.howard
the docs are wrong. this is in an empty rails app.
cfp:/tmp/app > cat config/initializers/action_mailer.rb
ActionMailer::Base.default_url_options = {:host => 'dojo4.com'}cfp:/tmp/app > ./script/rails runner 'p Rails.version; ActionMailer::Base.default_url_options = {:not => :deprecated}'
"3.0.0"no warning. nada.
-
ara.t.howard
i've also noticed that only setting ActionMailer::Base.default_url_options has any effect. if you use the config object the options are silently ignored. that will be another bug, however
-
David Trasbo
That is indeed another bug. If the docs state that something is deprecated, it is. Warning or no warning. In this case I think not throwing a warning was chosen because it's technically difficult (or potentially very inelegant) to differentiate between setting through
config.action_mailerandActionMailer::Basesince the former basically delegates to the latter.That's just my guess. My point is, though, that the docs aren't wrong. Feel free to provide a patch that throws a warning when setting through
ActionMailer::Base.