简体   繁体   中英

rails image_tag not working

UPDATE: does anyone know why the images show up in Firefox but not in Chrome?

I just tested my app in Firefox and the images show up! But they do not show up in Google Chrome. Does anyone know why this is?

Original question posted to Ruby-on-Rails and Ruby..below line


Ok, so I'm having hell with the image_tag in rails. I have the following code in my index.html.erb

code in..

<% @most_recent_tweets.each do |tweet| %>
    <%= image_tag (tweet["user"]["profile_image_url"]) %>
<% end %>

The following is what appears on the actual webpage

code out..

<img alt="Eli_face_1_bigger_normal" src="http://a2.twimg.com/profile_images/498988018/eli_face_1_bigger_normal.jpg">

The html for the image shows up in the code but no image displays in the browser. Why is this? Any ideas?

Try adding .html_safe

image_tag (tweet["user"]["profile_image_url"]).html_safe

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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