smathieu/preload_counts — pull request #2 by rylwin (2013-04-19 23:11:56+00:00)
Title: Use class name provided by association AND support self-referential counts

A user may specifiy a class_name on the association. We should respect
this setting otherwise we may try to constantize a non-existent class.

This PR contains a second commit that enables self-referential counts (e.g., parent/child relationship w/in a class). This is done by using a unique table alias name, which is just the original table name with a incrementing number appended.

Unfortunately, I couldn't submit this second commit w/o the first one, since it relies on some code from the first commit. Sorry about that.