diff --git a/activesupport/lib/active_support/core_ext/object/to_query.rb b/activesupport/lib/active_support/core_ext/object/to_query.rb
index <HASH>..<HASH> 100644
--- a/activesupport/lib/active_support/core_ext/object/to_query.rb
+++ b/activesupport/lib/active_support/core_ext/object/to_query.rb
@@ -1,4 +1,5 @@
 require 'active_support/core_ext/object/to_param'
+require 'cgi'
 
 class Object
   # Converts an object into a string suitable for use as a URL query string, using the given <tt>key</tt> as the
@@ -6,7 +7,6 @@ class Object
   #
   # Note: This method is defined as a default implementation for all Objects for Hash#to_query to work.
   def to_query(key)
-    require 'cgi' unless defined?(CGI) && defined?(CGI::escape)
     "#{CGI.escape(key.to_param)}=#{CGI.escape(to_param.to_s)}"
   end
 end
Do not check defined?(CGI) on every call #to_query