Rails link_to完整网址

时间:2015-02-16 01:27:02

标签: ruby-on-rails heroku

我正在尝试使用link_to在我的示例调查应用中生成调查的完整网址链接。我正在这样做的方式是在我的邮件浏览器中:

<p>The survey is located <%= link_to("here", survey_url(@survey)) %>.</p>

生成的链接为http://localhost:3000/surveys/2

但是,当在生产环境中运行相同的代码时,生成的链接应为http://example.herokuapp.com/surveys/2,而应为http://example.com/surveys/2

配置文件:

development.rb:

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

production.rb:

  config.action_mailer.default_url_options = { :host => 'http://example.com'}

任何想法为什么heroku将.herokuapp添加到主机网址的末尾/我可以做什么来生成网址为http://example.com/surveys/2

0 个答案:

没有答案