Commit df55efda authored by Andreas Brandl's avatar Andreas Brandl

Simplify filtering of non-human users (like ghosts).

Note that `ghost IS NOT TRUE` is equivalent to `ghost = 'f' OR ghost is
null`:

(true), (false), (NULL)) AS t (flag);
 flag | ?column? | ?column?
------+----------+----------
 t    | f        | f
 f    | t        | t
      | t        | t
(3 rows)

This makes it a little easier to create partial indexes for this (as only
one condition is needed).

Closes #43304.
parent f330f659
...@@ -431,7 +431,7 @@ class User < ActiveRecord::Base ...@@ -431,7 +431,7 @@ class User < ActiveRecord::Base
end end
def self.non_internal def self.non_internal
where(Hash[internal_attributes.zip([[false, nil]] * internal_attributes.size)]) where(internal_attributes.map { |attr| "#{attr} IS NOT TRUE" }.join(" AND "))
end end
# #
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment