How to write pure HTML code, for example an <img> tag in ERB?
So here is my answer for you:
By default, rails will serve all your resources from the public folder.
You can put the images in the assets/images folder and display them because of the assets pipeline .
However, if you want to use your own
<img src="/path/picture.png" /> as you asked in your question, then you should understand that the path you specify in your src (src = "/path/picture.png") will refer to the public folder of your application.
To do the above work, picture.png will not be placed in app/assets/images/picture.png , but should be placed in public/path/picture.png .
By convention, you will want to put the image in:
public/images/picture.png So you should use the img tag in your view as follows:
<img src="/images/picture.png" /> This will work just fine for your question.
If you are using Rails 4.2, you must use the resource pipeline,
So you should use image_tag or image_path instead of src in the Html tag.
Ref.
image_path("rails.png") # => "/assets/rails.png" <img src="<%= image_path('rails.png') %>" /> or
image_tag("rails.png") # => <img alt="Rails" src="/assets/rails.png" /> Read about asset_pipeline