I am working on a Rails 4 application. In this application I have a bunch of “elements” in my database. Each element has an attribute “image”, which is a line where I store some html that contains an html image tag that links to another site. For example, a typical element has an image:
<a href=\"http://anotherpage.com\" target=\"_blank\"><img src=\"http://anotherpage.com/path/to/image\" ></a>
I present this image by calling:
<%= raw item.image %>
But I have certain cases when I would like to make an image that is stored on my server. In the previous version of the rails, I could just store the image publicly and use an image tag, for example:
<img src="image.jpg" />
But I can’t figure out how to do this with the asset pipeline. I know I can do something like this:
<%= image_tag "image.jpg" %>
Or:
<img src="<%= asset_path('image.jpg') %>" />
, , , :
<%= raw item.image %>
, ruby , ?