image_tag('#') throw error The asset "#" is not present in the asset pipeline

Steps to reproduce

  • Use # for image_tag
image_tag '#', {}

Expected behavior

Should it combine something like this <img src="#"/>

Actual behavior

Raise exception:

Sprockets::Rails::Helper::AssetNotFound
The asset "#" is not present in the asset pipeline.

System configuration

Rails version: 6.0.3

Ruby version: 2.6.6


Found problems: it seems image_tag became more strict in rails-6 due to asset pipeline upgrade. For an asset that doesn't exist in pipeline, we can add the option skip_pipeline to avoid exceptions.

image_tag '#', skip_pipeline: true