Sha256: 6eee655e52c91c162e0bf60d92bdec1a9a092cc5555ab6cfff9b2b970edc53ab
Contents?: true
Size: 832 Bytes
Versions: 4
Compression:
Stored size: 832 Bytes
Contents
# frozen_string_literal: true # This module is deprecated and will be removed in the incoming versions module ActsAsTaggableOn module Utils class << self # Use ActsAsTaggableOn::Tag connection def connection ActsAsTaggableOn::Tag.connection end def using_postgresql? connection && %w[PostgreSQL PostGIS].include?(connection.adapter_name) end def using_mysql? connection && connection.adapter_name == 'Mysql2' end def sha_prefix(string) Digest::SHA1.hexdigest(string)[0..6] end def like_operator using_postgresql? ? 'ILIKE' : 'LIKE' end # escape _ and % characters in strings, since these are wildcards in SQL. def escape_like(str) str.gsub(/[!%_]/) { |x| "!#{x}" } end end end end
Version data entries
4 entries across 4 versions & 2 rubygems