【问题标题】:root_url on heroku - where is it getting 'Yourhost.com' from?heroku 上的 root_url - 它从哪里获取“Yourhost.com”?
【发布时间】:2012-01-09 01:02:45
【问题描述】:

这里有些混乱。使用 devise:invitable,并使用 sendgrid 插件从 heroku 发送电子邮件。

在本地,在邀请用户时生成的电子邮件中, 生成 http://localhost:3000/ - 这似乎完全正确 - 但是当部署到 heroku 时,当我收到邀请电子邮件时,同样的 会以http://yourhost.com/ 的形式出现...为什么?哪来的那套?

我认为 root_url 自动关闭了 routes.rb 并且我有

root :to => 'home#splash'

我觉得我错过了一些明显的东西?我将this question 的建议添加到应用程序控制器,但没有任何区别,邮件仍然引用http://yourhost.com/

帮助感谢谢谢。

【问题讨论】:

    标签: ruby-on-rails heroku


    【解决方案1】:

    在您的 config/environments/production.rb 设置中

    config.action_mailer.default_url_options = {:host => 'www.yourdomain.com'}
    

    您可能按照安装 Devise 后显示的 Devise 设置说明进行了添加

    config.action_mailer.default_url_options = { :host => 'localhost:3000' }
    

    到您的 development.rb 文件 - 但您只是忘记了生产。

    【讨论】:

    • 谢谢。是的,就是这样。我们会想知道,当我另一天在整个应用程序的文件中进行查找时,我没有设法找到 yourhost.com 是多么荒谬。谢谢约翰。
    猜你喜欢
    • 2012-09-14
    • 2021-11-18
    • 2021-10-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-11-29
    相关资源
    最近更新 更多