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..4408c6772 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)}%", "!") + tag_arel_table[:name].matches("%#{escaped_tag(tag)}%", "!") else - matches_attribute.matches(escaped_tag(tag), "!") + tag_arel_table[:name].matches(escaped_tag(tag), "!") end end