Forum: Ruby on Rails ActionMailer::Base.default_url_options

6fc19286d2eca6adb7dec27053fcd5c9?d=identicon&s=25 S. Widmann (Guest)
on 2011-02-05 16:34
(Received via mailing list)
Hi,

I want so set a default url for ActionMailer. I know,
ActionMailer::Base.default_url_options is deprecated, so I use
  config.action_mailer.default_url_options = {
    :host => "localhost"
  }

in my environments (test.rb, production.rb, ...). The problem is, I get
a
deprecation error and rails won't start. I have no solution...

Any hints for me?

Testing started at 16:31 ...
/Users/sebastian/.rvm/gems/ruby-1.9.2-p136/gems/actionmailer-3.0.3/lib/action_mailer/base.rb:763:in
`deprecated_url_options': You can no longer call
ActionMailer::Base.default_url_options directly. You need to set
config.action_mailer.default_url_options. If you are using ActionMailer
standalone, you need to include the routing url_helpers directly.
(RuntimeError)
    from
/Users/sebastian/.rvm/gems/ruby-1.9.2-p136/gems/actionmailer-3.0.3/lib/action_mailer/base.rb:756:in
`default_url_options='
    from
/Users/sebastian/.rvm/gems/ruby-1.9.2-p136/gems/actionmailer-3.0.3/lib/action_mailer/railtie.rb:22:in
`block (3 levels) in <class:Railtie>'
    from
/Users/sebastian/.rvm/gems/ruby-1.9.2-p136/gems/actionmailer-3.0.3/lib/action_mailer/railtie.rb:22:in
`each'
    from
/Users/sebastian/.rvm/gems/ruby-1.9.2-p136/gems/actionmailer-3.0.3/lib/action_mailer/railtie.rb:22:in
`block (2 levels) in <class:Railtie>'
    from
/Users/sebastian/.rvm/gems/ruby-1.9.2-p136/gems/activesupport-3.0.3/lib/active_support/lazy_load_hooks.rb:36:in
`instance_eval'
    from
/Users/sebastian/.rvm/gems/ruby-1.9.2-p136/gems/activesupport-3.0.3/lib/active_support/lazy_load_hooks.rb:36:in
`execute_hook'
    from
/Users/sebastian/.rvm/gems/ruby-1.9.2-p136/gems/activesupport-3.0.3/lib/active_support/lazy_load_hooks.rb:43:in
`block in run_load_hooks'
    from
/Users/sebastian/.rvm/gems/ruby-1.9.2-p136/gems/activesupport-3.0.3/lib/active_support/lazy_load_hooks.rb:42:in
`each'
    from
/Users/sebastian/.rvm/gems/ruby-1.9.2-p136/gems/activesupport-3.0.3/lib/active_support/lazy_load_hooks.rb:42:in
`run_load_hooks'
    from
/Users/sebastian/.rvm/gems/ruby-1.9.2-p136/gems/actionmailer-3.0.3/lib/action_mailer/base.rb:772:in
`<class:Base>'
    from
/Users/sebastian/.rvm/gems/ruby-1.9.2-p136/gems/actionmailer-3.0.3/lib/action_mailer/base.rb:333:in
`<module:ActionMailer>'
    from
/Users/sebastian/.rvm/gems/ruby-1.9.2-p136/gems/actionmailer-3.0.3/lib/action_mailer/base.rb:9:in
`<top (required)>'
    from
/Users/sebastian/Sites/rails/sampleapp/app/mailers/contact_mailer.rb:1:in
`<top (required)>'
    from
/Users/sebastian/.rvm/gems/ruby-1.9.2-p136/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in
`require'
    from
/Users/sebastian/.rvm/gems/ruby-1.9.2-p136/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in
`block in require'
    from
/Users/sebastian/.rvm/gems/ruby-1.9.2-p136/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:227:in
`load_dependency'
    from
/Users/sebastian/.rvm/gems/ruby-1.9.2-p136/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in
`require'
    from
/Users/sebastian/.rvm/gems/ruby-1.9.2-p136/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:346:in
`require_or_load'
    from
/Users/sebastian/.rvm/gems/ruby-1.9.2-p136/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:300:in
`depend_on'
    from
/Users/sebastian/.rvm/gems/ruby-1.9.2-p136/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:216:in
`require_dependency'
    from
/Users/sebastian/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.3/lib/rails/engine.rb:138:in
`block (2 levels) in eager_load!'
    from
/Users/sebastian/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.3/lib/rails/engine.rb:137:in
`each'
    from
/Users/sebastian/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.3/lib/rails/engine.rb:137:in
`block in eager_load!'
    from
/Users/sebastian/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.3/lib/rails/engine.rb:135:in
`each'
    from
/Users/sebastian/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.3/lib/rails/engine.rb:135:in
`eager_load!'
    from
/Users/sebastian/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.3/lib/rails/application.rb:108:in
`eager_load!'
    from
/Users/sebastian/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.3/lib/rails/application/finisher.rb:41:in
`block in <module:Finisher>'
    from
/Users/sebastian/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.3/lib/rails/initializable.rb:25:in
`instance_exec'
    from
/Users/sebastian/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.3/lib/rails/initializable.rb:25:in
`run'
    from
/Users/sebastian/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.3/lib/rails/initializable.rb:50:in
`block in run_initializers'
    from
/Users/sebastian/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.3/lib/rails/initializable.rb:49:in
`each'
    from
/Users/sebastian/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.3/lib/rails/initializable.rb:49:in
`run_initializers'
    from
/Users/sebastian/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.3/lib/rails/application.rb:134:in
`initialize!'
    from
/Users/sebastian/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.3/lib/rails/application.rb:77:in
`method_missing'
    from
/Users/sebastian/Sites/rails/sampleapp/config/environment.rb:5:in
`<top (required)>'
    from
/Users/sebastian/Sites/rails/sampleapp/spec/spec_helper.rb:15:in
`require'
    from
/Users/sebastian/Sites/rails/sampleapp/spec/spec_helper.rb:15:in
`block in <top (required)>'
    from
/Users/sebastian/.rvm/gems/ruby-1.9.2-p136/gems/spork-0.9.0.rc2/lib/spork.rb:23:in
`prefork'
    from /Users/sebastian/Sites/rails/sampleapp/spec/spec_helper.rb:7:in
`<top (required)>'
    from
/Users/sebastian/Sites/rails/sampleapp/spec/controllers/events/contact_messages_controller_spec.rb:2:in
`require'
    from
/Users/sebastian/Sites/rails/sampleapp/spec/controllers/events/contact_messages_controller_spec.rb:2:in
`<top (required)>'
    from
/Users/sebastian/.rvm/gems/ruby-1.9.2-p136/gems/rspec-core-2.4.0/lib/rspec/core/configuration.rb:387:in
`load'
    from
/Users/sebastian/.rvm/gems/ruby-1.9.2-p136/gems/rspec-core-2.4.0/lib/rspec/core/configuration.rb:387:in
`block in load_spec_files'
    from
/Users/sebastian/.rvm/gems/ruby-1.9.2-p136/gems/rspec-core-2.4.0/lib/rspec/core/configuration.rb:387:in
`map'
    from
/Users/sebastian/.rvm/gems/ruby-1.9.2-p136/gems/rspec-core-2.4.0/lib/rspec/core/configuration.rb:387:in
`load_spec_files'
    from
/Users/sebastian/.rvm/gems/ruby-1.9.2-p136/gems/rspec-core-2.4.0/lib/rspec/core/command_line.rb:18:in
`run'
    from
/Users/sebastian/.rvm/gems/ruby-1.9.2-p136/gems/rspec-core-2.4.0/lib/rspec/core/runner.rb:55:in
`run_in_process'
    from
/Users/sebastian/.rvm/gems/ruby-1.9.2-p136/gems/rspec-core-2.4.0/lib/rspec/core/runner.rb:46:in
`run'
    from
/Users/sebastian/.rvm/gems/ruby-1.9.2-p136/gems/rspec-core-2.4.0/lib/rspec/core/runner.rb:10:in
`block in autorun'

Regards,
sewid
6fc19286d2eca6adb7dec27053fcd5c9?d=identicon&s=25 S. Widmann (Guest)
on 2011-02-06 08:39
(Received via mailing list)
Hi,

I just found out, that this problem only occurs, when using
  config.cache_classes = true
in my config/test.rb or config/development.rb. If I set it to false,
everything works fine.

Any ideas, why?

Regards and thanks a lot,
sewid
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.