Fix undefined method to_query for Hash

When cherry-picking `active_support/core_ext/object/to_param` in 4.1.*,
we still see an undefined method to_query for hash unless we also pull
in `.../to_query`.

This was resolved on master in c420a8da, so this is exclusively a
backport based on the Active Support Core Extensions guide's
[Cherry-picking a Definition] section.

[Cherry-picking a Definition]: http://guides.rubyonrails.org/active_support_core_extensions.html#cherry-picking-a-definition