Skip to content

Commit

Permalink
case sensitivity fix for tagged_with mbleigh#965 (mbleigh#990)
Browse files Browse the repository at this point in the history
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: René Kersten <rene.kersten@gmail.com>
  • Loading branch information
2 people authored and rolandoalvarado committed Nov 11, 2021
1 parent c433d93 commit f4c1b25
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down

0 comments on commit f4c1b25

Please sign in to comment.