Create image_tag for lower level foldername + stored image URL
How do I create an image_tag for a images stored in a lower level of the default assets/images directory? Currently I am storing all of my pictures in the assets/images/pictures folder.
Heres an example. Currently using @mypic
instance variable with the stored base url:
pic1.jpg
.erb file:
<%= image_tag @mypic.photoUrl %>
creates an image tag
<img src="/assets/pic1.jpg" alt="pic1">
What I want is for the src to be /assets/imag开发者_运维知识库es/pictures/pic1.jpg
OR is ruby on rails convention to put all my heterogeneous images (eg logo, profile pics, arrow pics, landscape pics, button pics) in the image directory?
Thanks!
The quick, easy solution would be to just write `<%= image_tag "pictures/#{@mypic.photoUrl}" %>.
Documentation for image_tag here.
精彩评论