Includes HABTM returns correct size now. Fixes #16032 and #15244 for master

    Includes HABTM returns correct size now. It's caused by the join dependency only instantiates one HABTM object because the join table hasn't a primary key.
    Updated commit and test fixed from @bigxiang commit dbaa837

    Fixes #16032.

    Examples:

        before:

        Project.first.salaried_developers.size # => 3
        Project.includes(:salaried_developers).first.salaried_developers.size # => 1

        after:

        Project.first.salaried_developers.size # => 3
        Project.includes(:salaried_developers).first.salaried_developers.size # => 3
`hash` on `ActiveRecord::Base` will be based on `id`, or `object_id` if `id` is `nil`. So if duplicates are being returned, it's because something other than an AR model is being used as the key.