module FilesFilterable
  extend ActiveSupport::Concern

  included do
    def image_files
      files_blobs.where("content_type ILIKE ?", "%image%")
    end
  
    def video_files
      files_blobs.where("content_type ILIKE ?", "%video%")
    end
  
    def other_files
      files_blobs.where("NOT content_type ILIKE ANY (array[?])", ["%image%", "%video%"])
    end
  end
end
