Rails version: 5.2.4
Ruby version 2.6.10
Per "image_tag" documentation, it should produce image tag with url: "/assets/...", but when I try in rails console, it produces the url "/images/..."(the screenshot below), it make my website cannot show. How can I make it works correctly?
Also the "/assets/..." url can load the image, but "images/..." cannot
Because there's a lot of context loaded by Rails for those helper methods to work, you can't just include ActionView::Helpers::AssetTagHelper
as you've done. Instead call the helper on the helper
object in the rails console:
[1] pry(main)> helper.image_tag("foo.jpg")
=> "<img src=\"/assets/foo-04024382391bb910584145d8113cf35ef376b55d125bb4516cebeb14ce788597.jpg\" />"