Active Record joins with default_scope leads to duplicated sql #14351.

A default scope that generates different sql on each call will
generate almost duplicate SQL in the resulting query. For example:

    def self.default_scope
        where('active_at <= :now AND inactive_at > :now',
            now: Time.zone.now)
    end

Generates

    ...
    (active_at <= '2014-03-11 03:36:13.994068'
    AND inactive_at > '2014-03-11 03:36:13.994068')
    AND (active_at <= '2014-03-11 03:36:13.967550'
    AND inactive_at > '2014-03-11 03:36:13.967550')

It only happens when the user defines their own class method for
default_scope, not when using the default_scope method with a block.