Fixed count method to handle result from grouped relations.

Because AR return an OrderedHash as count result for grouped relations.