Rails' Object#blank? and Object#present? return true for empty
Enumerable objects. This is because they don't implement #empty?.
Our prior effort to optimize these methods for Relation by delegating them to
#each broke them for this reason, always returning true. Instead, we
delegate #any? which does exist, and implement Relation#empty? directly as
its inverse. Rails provides the #blank? and #present? implementations.
Rails'
Object#blank?
andObject#present?
returntrue
for emptyEnumerable
objects. This is because they don't implement#empty?
.Our prior effort to optimize these methods for
Relation
by delegating them to#each
broke them for this reason, always returningtrue
. Instead, we delegate#any?
which does exist, and implementRelation#empty?
directly as its inverse. Rails provides the#blank?
and#present?
implementations.