module ActiveStorage::Blob::Representable

def previewable?

Returns true if any registered previewer accepts the blob. By default, this will return true for videos and PDF documents.
def previewable?
  ActiveStorage.previewers.any? { |klass| klass.accept?(self) }
end