Module: Fileboost::ImageTagPatch

Defined in:
lib/fileboost/image_tag_patch.rb

Instance Method Summary collapse

Instance Method Details

#image_tag(source, options = {}) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/fileboost/image_tag_patch.rb', line 3

def image_tag(source, options = {})
  # If this is an ActiveStorage asset and Fileboost is configured, use fileboost_image_tag
  if valid_activestorage_asset?(source) && Fileboost.config.valid?
    fileboost_image_tag(source, **options)
  else
    # Fall back to Rails' original image_tag for all other cases
    super(source, options)
  end
rescue
  # If there's any error with Fileboost processing, fall back to original Rails behavior
  super(source, options)
end