邮件程序中的image_tag不使用asset_host [英] image_tag in mailer not using asset_host
本文介绍了邮件程序中的image_tag不使用asset_host的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
image_tag没有使用我设置的asset_host。有什么想法吗?我唯一能想到的就是它与作为邮件程序有关。
image_tag isn't using the asset_host I've set. Any ideas why? The only thing I can think of is it having to do with it being a Mailer.
config / environment / development.rb
config.action_controller.asset_host = "http://localhost:3000"
myMailer.rb
<%= image_tag "logo.png", :style=>"margin-left:10px; padding-bottom:15px;" %>
渲染为:
<img alt="Logo" src="/images/logo.png?1303090162" style="margin-left:10px; padding-bottom:15px;" />
在控制台中:
> MyApp::Application.config.action_controller
#<OrderedHash {… :asset_host=>"http://localhost:3000", …}>
我需要image_tag创建完整的路径url,因为它将显示在电子邮件中。 / p>
I need the image_tag to create a full path url because it will be showing up in an email.
推荐答案
我以前错了。这是您需要的解决方案(直到rails 3.1为止,asset_host的配置变得统一):
I was wrong before. This is the solution you need (until rails 3.1 where the asset_host configurations become unified):
config.action_mailer.asset_host = "http://localhost:3000"
这篇关于邮件程序中的image_tag不使用asset_host的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文