简体   繁体   中英

Ruby On Rails image_tag( ) Issue

Quick question for the RoR experts out there.

I'm having a problem with getting the image_tag( ) method to properly format my HTML img element.

I'm pretty certain the reason my image will not load is because of the "/images/" directory that is being added to the front of the URL. (SEE BELOW)


I'm calling the image_tag( ) method like this :: 在此处输入图片说明


I'm consuming MY method like this ::

在此处输入图片说明


This is the HTML tag that's getting generated :: 在此处输入图片说明


Anyone know why this /images/ directory is getting placed on the front of my URL?

Thanks!

Try changing https:/secure.gravatar.com... to https://secure.gravatar.com ...

Notice you have only one '/'

You have a syntax error in your URL.

An example: If in my controller I use the following:

@my_image_url = "https:/localhost/desktop/02.png"

When I look at the generated page I get:

<img src="/images/https:/localhost/desktop/02.png" alt="bob">

If in my controller I use the following:

@my_image_url = "https://localhost/desktop/02.png"

When I look at the generated page I get:

<img src="https://localhost/desktop/02.png" alt="bob">

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