Sha256: 1d8dec616c62cd14cc31f29c5ff1503d30429fee43d5216c57a3625bb20ffd78
Contents?: true
Size: 865 Bytes
Versions: 3
Compression:
Stored size: 865 Bytes
Contents
# 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 && 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 active_record5? ::ActiveRecord::VERSION::MAJOR == 5 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
acts-as-taggable-on-5.0.0 | lib/acts_as_taggable_on/utils.rb |
acts-as-taggable-on-4.0.0 | lib/acts_as_taggable_on/utils.rb |
acts-as-taggable-on-4.0.0.pre | lib/acts_as_taggable_on/utils.rb |