开发者

how to make an image visible in Rails

I am a newbie to Rails. In html if we want make an image visible 开发者_JAVA技巧we write it as <img src="xyz.jpg"/>.In this way I want to know how to make that kind of stuff in Rails.How to make an image src in Rails to make it visible.


With the image_tag method.

In your case it would be:

image_tag("xyz.jpg")

This will output as:

 <img src="/images/xyz.jpg" />

Which assumes that the path is images/xyz.jpg

See here for more details.


Do you mean an image tag?

image_tag("icon.png")

http://apidock.com/rails/ActionView/Helpers/AssetTagHelper/image_tag


In your ERB it will look like this: <%= image_tag 'xyz.jpg' %>

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜