rails/rails — pull request #15322 by dv (2014-05-25 22:17:16+00:00)
Title: Use the join_table calculated by the association

For some reason, AssociationReflection just copied the [code from the Associations::Builder](https://github.com/rails/rails/blob/master/activerecord/lib/active_record/associations/builder/has_and_belongs_to_many.rb#L14) to return the `join_table` name.

Calling the actual table_name of the reflection's class gives us the table name of the join_table.

This breaks [3 tests in reflection_tests.rb](https://github.com/rails/rails/blob/master/activerecord/test/cases/reflection_test.rb#L352-L389) which used a Struct to emulate a tiny ActiveRecord, but never actually defined any associations, so through_reflection here is nil making the test fail. I updated the tests to use real AR models. Let me know if this is a Bad Idea :)