post query builder: fix incompatibilities with Rails 6.1.

* Rename the `#negate` and `#and` methods that we monkey patch into
  ActiveRecord::Relation. These methods are now defined in Rails 6.1, but
  they shadow our methods and have slightly different behavior.
* Fix a call to `invert`. It no longer accepts an argument.
This commit is contained in:
evazion
2020-12-13 04:02:25 -06:00
parent 8d87b1a0c0
commit 35134abe8f
2 changed files with 6 additions and 5 deletions

View File

@@ -92,8 +92,8 @@ class PostQueryBuilder
def metatags_match(metatags, relation)
metatags.each do |metatag|
clause = metatag_matches(metatag.name, metatag.value, quoted: metatag.quoted)
clause = clause.negate if metatag.negated
relation = relation.and(clause)
clause = clause.negate_relation if metatag.negated
relation = relation.and_relation(clause)
end
relation