Fixed bug with Rails 4 and association#to_sql

You can see the issue here: https://coderwall.com/p/45ombq [as well as how I fixed it]. This problem raises itself in acts-as-taggable-on when you try something like:

    Host.first.entries.all_tags
    # OR
    Host.first.entries.tag_counts_on(:foo)

I didn't include tests because when I ran the suite via rake appraisal:rails-4 there was a lot of errors and I wasn't sure whether committing to a red suite was any better. If you guys want, I totally can write tests for this.