Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/53.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails Rails 3.2.15中图像标签的绝对路径问题_Ruby On Rails_Asset Pipeline_Mailer - Fatal编程技术网

Ruby on rails Rails 3.2.15中图像标签的绝对路径问题

Ruby on rails Rails 3.2.15中图像标签的绝对路径问题,ruby-on-rails,asset-pipeline,mailer,Ruby On Rails,Asset Pipeline,Mailer,我在Rails邮件程序中指定图像的绝对路径时遇到了很多麻烦。我已经看过很多关于如何做到这一点的例子,但没有一个对我有效 这是我当前在development.rb文件中的内容: config.action_mailer.default_url_options = { :host => ENV['DEV_HOST_URL'] } /* Added the following 2 lines to attempt to get direct URL */ config.action

我在Rails邮件程序中指定图像的绝对路径时遇到了很多麻烦。我已经看过很多关于如何做到这一点的例子,但没有一个对我有效

这是我当前在development.rb文件中的内容:

  config.action_mailer.default_url_options = { :host => ENV['DEV_HOST_URL'] }

  /* Added the following 2 lines to attempt to get direct URL */
  config.action_controller.asset_host = 'http://localhost:3000'
  config.action_mailer.asset_host = config.action_controller.asset_host

  config.assets.compress = false

  config.serve_static_assets = false

  config.assets.precompile << /(^[^_\/]|\/[^_])[^\/]*$/

  # Expands the lines which load the assets
  config.assets.debug = true
我尝试引用我的邮件布局文件中的图像,如下所示:

<%= image_tag("logo.png", :class=>"logo_icon" ) %>

我做错了什么?

这可能是显而易见的,但对我来说一开始不是这样的——Gmail不会加载本地图像。当我将代码推到生产环境中时,我能够看到正确的图像

我已经用多个图片测试了我的邮件,看起来https链接工作正常。可能是gmail不接受https链接吗?或者仅仅是本地图像?我一整天都在想这个问题,所以我非常感谢你的帮助!
<%= image_tag("logo.png", :class=>"logo_icon" ) %>
<img alt="logo" src="https://ci6.googleusercontent.com/proxy/LQ9_UbICRgtYrLdHWTYSCZzpvyyqEPa8zUTd1OjWkQZQCgnb5YdOQpbghkTKOqBF1miTwxYJYHNdriZh5de4XW161GU_8jvmNN2D3KU=s0-d-e1-ft#http://localhost:3000/assets/logo.png" style="width:50px;border:1px solid #ccc;min-height:20px;width:20px;border:none">
http://localhost:3000/assets/logo.png