Added associations to count query

Added the associations to the count query so that you can add where callbacks to associated columns.