Ruby on rails 即使配置了默认主机,邮件程序模板中的命名路由也会引发“缺少:主机”选项
在我的应用程序的任何邮件程序中使用命名路由会引发以下错误:Ruby on rails 即使配置了默认主机,邮件程序模板中的命名路由也会引发“缺少:主机”选项,ruby-on-rails,routes,actionmailer,spree,Ruby On Rails,Routes,Actionmailer,Spree,在我的应用程序的任何邮件程序中使用命名路由会引发以下错误: ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true 这并不是一直都在发生,我不能在开发或生产模式中本地复制 如果我在生产环境中打开控制台,我可以确认默认主机已配置: ActionMailer::Base.default_u
ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true
这并不是一直都在发生,我不能在开发或生产模式中本地复制
如果我在生产环境中打开控制台,我可以确认默认主机已配置:
ActionMailer::Base.default_url_options
=> {:host=>"thehost.com"}
Rails.application.config.action_mailer.default_url_options
=> {:host=>"thehost.com"}
Spree::Core::Engine.config.action_mailer.default_url_options
=> {:host=>"thehost.com"}
正在通过Spree的路由代理调用所有命名路由:
<%= spree.my_route_url %>
这可能是多余的,因为Spree还从:site_url首选项(我已正确配置)设置它
(来自mail_settings.rb)
Spree版本1-0-stable
轨道3.1.3
Ruby 1.9.3我能够确认,当这个错误发生时,默认的url选项是:{“主机”=>“”。似乎需要重新启动进程,或者在控制台中正确设置该值。您好,您解决了这个问题吗?我也有类似的问题…好吧,我明白了。。。
config.action_mailer.default_url_options = { :host => "thehost.com" }
ActionMailer::Base.default_url_options[:host] = Spree::Config[:site_url]