简体   繁体   English

使用config Url而不是config.ip

[英]Use config Url instead of config.ip

In my config/environment/development.rb, i have 在我的config/environment/development.rb,我有

config.ip: 'http://localhost:3000'

In my config/environment/production.rb, i have 在我的config/environment/production.rb,我有

config.ip = 'http://52.74.70.227'

I want to use something like config.url = 'http://example.com' So when someone recives an activation email link from me the link shows http://example.com/abc intead of http://52.74.70.227/abc 我想使用类似config.url = 'http://example.com'类的东西,因此当有人从我那里收到激活电子邮件链接时,该链接显示http://example.com/abc intead为http://52.74.70.227/abc

in config/environment/development.rb define config/environment/development.rb定义

config.action_mailer.default_url_options = {host: "localhost:3000"}

in config/environment/production.rb define config/environment/production.rb定义

config.action_mailer.default_url_options = {host: "example.com"}

for more info check here http://api.rubyonrails.org/classes/ActionMailer/Base.html 有关更多信息,请在此处检查http://api.rubyonrails.org/classes/ActionMailer/Base.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM