def attachment_image_tag(record, name, *args, fallback: nil, host: nil, prefix: nil, format: nil, **options)
      file = record && record.public_send(name)
      classes = ["attachment", (record.class.model_name.singular if record), name, *options[:class]]

      if file
        image_tag(attachment_url(record, name, *args, host: host, prefix: prefix, format: format), options.merge(class: classes))
      elsif fallback
        classes << "fallback"
        image_tag(fallback, options.merge(class: classes))
      end
    end
def attachment_image_tag(record, name, *args, fallback: nil, host: nil, prefix: nil, format: nil, **options)
      file = record && record.public_send(name)
      classes = ["attachment", (record.class.model_name.singular if record), name, *options[:class]]

      if file
        image_tag(attachment_url(record, name, *args, host: host, prefix: prefix, format: format), options.merge(class: classes))
      elsif fallback
        classes << "fallback"
        image_tag(fallback, options.merge(class: classes))
      end
    end
Generates an image tag for the given attachment, adding appropriate
 classes and optionally falling back to the given fallback image if there
 is no file attached.

 Returns `nil` if there is no file attached and no fallback specified.

 @param [String] fallback                   The path to an image asset to be used as a fallback
 @param [Hash] options                      Additional options for the image tag
 @see #attachment_url
 @return [ActiveSupport::SafeBuffer, nil]   The generated image tag