Tuesday, December 14, 2010

Problem: Missing host to link to! Please provide :host parameter or set default_url_options[:host] when sending emails.


Problem:
Missing host to link to! Please provide :host parameter or set default_url_options[:host] when sending emails.
Solution:
You can pass host parameter to url functions, but it’s cleaner to configure it with a before_filter globally in your application_controller.rb:
  # application_controller.rb
before_filter :mailer_set_url_options
 
...
 
def mailer_set_url_options
ActionMailer::Base.default_url_options[:host] = request.host_with_port
end

No comments:

Post a Comment