开发者

How to display image assets in Rails 3.1 email views?

I have a Rails 3.1 (rc6) app with some HTML emails.

I'm trying to display some inline images in an HTML email message. How do I get image_tag to use the proper absolute URL to my开发者_运维百科 image asset? (i.e. I want it to give me http://myproductionserver.com/assets/email_tile-89eda655d6fdd07de75f56547a4a4041.jpg instead of just /assets/email_tile-89eda655d6fdd07de75f56547a4a4041.jpg)

(I tried setting config.action_mailer.asset_host = "http://myproductionserver.com" in my production.rb file but then it just renders an image URL with out the proper asset pipeline name)

EDIT: this also raises the question of expired asset URLs in old emails. Will images in emails be broken after a deploy?


I believe you actually need to set your action_controller.asst_hosts:

config.action_controller.asset_host =  "http://myproductionserver.com"
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜