diff options
author | Andrew White <andyw@pixeltrix.co.uk> | 2014-05-13 17:42:30 +0100 |
---|---|---|
committer | Andrew White <andyw@pixeltrix.co.uk> | 2014-05-13 17:42:30 +0100 |
commit | 977d36af8f84f467b6e4d21115cd4f84e50cfcb3 (patch) | |
tree | a3551600ffe26b6de15bce3947883c3954fbcb11 /activesupport/lib/active_support/core_ext/object/to_query.rb | |
parent | c4c5801bd9ded4c23c1e35f6a4d991f1d16db113 (diff) | |
parent | f1798951e747da23bd1f30a7f1a6c041a117bd8a (diff) | |
download | rails-977d36af8f84f467b6e4d21115cd4f84e50cfcb3.tar.gz rails-977d36af8f84f467b6e4d21115cd4f84e50cfcb3.tar.bz2 rails-977d36af8f84f467b6e4d21115cd4f84e50cfcb3.zip |
Merge pull request #15091 from printercu/patch-5
Do not check defined?(CGI) on every call #to_query
Diffstat (limited to 'activesupport/lib/active_support/core_ext/object/to_query.rb')
-rw-r--r-- | activesupport/lib/active_support/core_ext/object/to_query.rb | 2 |
1 files changed, 1 insertions, 1 deletions
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 37352fa608..172f06ed64 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 |