加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby-on-rails – 在rails中将config.action_mailer.default_url

发布时间:2020-12-17 02:31:16 所属栏目:百科 来源:网络整理
导读:如何在config / environments / production.rb中动态设置主机: config.action_mailer.default_url_options = { :host = THE_HOST} 这是应用程序在暂存和生产时正常工作.我们的登台服务器是stage.app.com,链接需要去那里. 解决方法 在config / environments
如何在config / environments / production.rb中动态设置主机:

config.action_mailer.default_url_options = { :host => THE_HOST}

这是应用程序在暂存和生产时正常工作.我们的登台服务器是stage.app.com,链接需要去那里.

解决方法

在config / environments / production.rb中执行以下操作:

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

并在config / environments / staging.rb中执行此操作:

config.action_mailer.default_url_options = { :host => 'stage.app.com' }

正如@BrettBender评论的那样:

You do not need to dynamically set the host. For an app in production,production.rb will be evaluated. For an app running in staging environment,rails will load the staging file automatically (same with development or any custom environments you define)

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读