Added associations to count query

Added the associations to the count query so that you can add where callbacks to associated columns. Issue #18 is the problem related to this pull request (sorry i do not know how to link a pull request with an issue)