From 47da5036dea61cb971bfaf72de5fa93c85255307 Mon Sep 17 00:00:00 2001 From: Andrew Thurlow Date: Fri, 8 May 2020 05:12:16 +1000 Subject: [PATCH] case sensitivity fix for tagged_with #965 (#990) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit arel matches and matches_any has a third parameter for case sensitivity, that was not set and always false. So ActsAsTaggableOn.strict_case_match didn't work with PostgreSQL Co-authored-by: ReneĢ Kersten --- .../taggable/tagged_with_query/query_base.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/acts_as_taggable_on/taggable/tagged_with_query/query_base.rb b/lib/acts_as_taggable_on/taggable/tagged_with_query/query_base.rb index b556d70f0..36c9d97a2 100644 --- a/lib/acts_as_taggable_on/taggable/tagged_with_query/query_base.rb +++ b/lib/acts_as_taggable_on/taggable/tagged_with_query/query_base.rb @@ -29,9 +29,9 @@ def tag_match_type(tag) matches_attribute = matches_attribute.lower unless ActsAsTaggableOn.strict_case_match if options[:wild].present? - matches_attribute.matches("%#{escaped_tag(tag)}%", "!") + matches_attribute.matches("%#{escaped_tag(tag)}%", "!", ActsAsTaggableOn.strict_case_match) else - matches_attribute.matches(escaped_tag(tag), "!") + matches_attribute.matches(escaped_tag(tag), "!", ActsAsTaggableOn.strict_case_match) end end @@ -40,9 +40,9 @@ def tags_match_type matches_attribute = matches_attribute.lower unless ActsAsTaggableOn.strict_case_match if options[:wild].present? - matches_attribute.matches_any(tag_list.map{|tag| "%#{escaped_tag(tag)}%"}, "!") + matches_attribute.matches_any(tag_list.map{|tag| "%#{escaped_tag(tag)}%"}, "!", ActsAsTaggableOn.strict_case_match) else - matches_attribute.matches_any(tag_list.map{|tag| "#{escaped_tag(tag)}"}, "!") + matches_attribute.matches_any(tag_list.map{|tag| "#{escaped_tag(tag)}"}, "!", ActsAsTaggableOn.strict_case_match) end end