Sha256: 6f03b10fe3040e558d06f01ebd056d2033e5bd3f3b5ef63260faadcdb012915d
Contents?: true
Size: 757 Bytes
Versions: 10
Compression:
Stored size: 757 Bytes
Contents
module MakeTaggable module Utils class << self def connection MakeTaggable::Tag.connection end def using_postgresql? connection && connection.adapter_name == "PostgreSQL" 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 def legacy_activerecord? ActiveRecord.version <= Gem::Version.new("5.3.0") 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
10 entries across 10 versions & 1 rubygems