Extend AR's NULL_RELATION directly
Extend AR's NULL_RELATION directly

Instead of defining a new constant. In AR 5.1.5, preloader internals
changed and in lib/active_record/associations/preloader/association.rb
line 141 there is an attempt to scope.merge!() the passed preload_scope
unless it is == to NULL_RELATION.

As our patch was extending the NULL_RELATION through the creation of
a new constant and passing that along, assuming duck typing. However
AR broke that and relies on an explicit instance equality.

Thus, we are now including the AsOfTimeHolder inside NULL_RELATION
directly. Given that Struct#== compares all the struct members, and
does not take into account other instance variables, it continues
to return true even when @as_of_time is changed.

ifad/chronomodel