This project is archived and is in readonly mode.

#5749 ✓invalid

ActionMailer::Base.default_url_options are not actually deprecated

Reported by ara.t.howard | October 1st, 2010 @ 07:32 PM

cfp:/tmp/foo > grep action_mailer config/application.rb

config.action_mailer.default_url_options = {:only_path => false}

cfp:/tmp/foo > ./script/rails generate mailer Mailer

  create  app/mailers/mailer.rb
  invoke  erb
  create    app/views/mailer
  invoke  test_unit
  create    test/functional/mailer_test.rb

cfp:/tmp/foo > ./script/rails runner 'require "action_mailer/version"; p RUBY_VERSION; p Rails::VERSION::STRING; p ActionMailer::VERSION::STRING; p Mailer.default_url_options'
"1.8.7" "3.0.0" "3.0.0" {:only_path=>false}

Comments and changes to this ticket

  • David Trasbo

    David Trasbo October 10th, 2010 @ 04:37 PM

    • State changed from “new” to “invalid”
    • Importance changed from “” to “Low”

    Yes, default_url_options is 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 => "" }

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

    Setting default_url_options through ActionMailer::Base directly is deprecated. Doing it through the standard config object is not.

  • ara.t.howard

    ara.t.howard October 11th, 2010 @ 02:37 AM

    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 => ''}

    cfp:/tmp/app > ./script/rails runner 'p Rails.version; ActionMailer::Base.default_url_options = {:not => :deprecated}'

    no warning. nada.

  • ara.t.howard

    ara.t.howard October 11th, 2010 @ 02:38 AM

    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

    David Trasbo October 11th, 2010 @ 06:47 PM

    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_mailer and ActionMailer::Base since 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.

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>