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
Thix fix is not mine, maybe @bigxiang can explain it better, but using always AR model breaks some tests, because same record is returned multiple times. An example:

 23) Failure:
RelationTest#test_eager_association_loading_of_stis_with_multiple_references [/home/rzheng/ruby/rails-4.1/activerecord/test/cases/relations_test.rb:496]:
--- expected
+++ actual
@@ -1 +1 @@
-[#<Author id: 1, name: "David", author_address_id: 1, author_address_extra_id: 2, organization_id: "No Such Agency", owned_essay_id: "A Modest Proposal">]
+[#<Author id: 1, name: "David", author_address_id: 1, author_address_extra_id: 2, organization_id: "No Such Agency", owned_essay_id: "A Modest Proposal">, #<Author id: 1, name: "David", author_address_id: 1, author_address_extra_id: 2, organization_id: "No Such Agency", owned_essay_id: "A Modest Proposal">, #<Author id: 1, name: "David", author_address_id: 1, author_address_extra_id: 2, organization_id: "No Such Agency", owned_essay_id: "A Modest Proposal">, #<Author id: 1, name: "David", author_address_id: 1, author_address_extra_id: 2, organization_id: "No Such Agency", owned_essay_id: "A Modest Proposal">, #<Author id: 1, name: "David", author_address_id: 1, author_address_extra_id: 2, organization_id: "No Such Agency", owned_essay_id: "A Modest Proposal">, #<Author id: 1, name: "David", author_address_id: 1, author_address_extra_id: 2, organization_id: "No Such Agency", owned_essay_id: "A Modest Proposal">, #<Author id: 1, name: "David", author_address_id: 1, author_address_extra_id: 2, organization_id: "No Such Agency", owned_essay_id: "A Modest Proposal">, #<Author id: 1, name: "David", author_address_id: 1, author_address_extra_id: 2, organization_id: "No Such Agency", owned_essay_id: "A Modest Proposal">, #<Author id: 1, name: "David", author_address_id: 1, author_address_extra_id: 2, organization_id: "No Such Agency", owned_essay_id: "A Modest Proposal">]

HABTM is implemented with has_many through a intermediate model without primary_key, so on previous change parent_key would be nil for every record and join_root.instantiate only would be called once. However, on other associations, primary_key must be used because join_root.instantiate must be called only once for every different model.

Then, if ar_parent.id returns nil, ar_parent should be used as hash key, becuase we don't use nil keys.