diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2008-11-26 00:23:00 -0800 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2008-11-26 00:31:55 -0800 |
commit | 27dbc27c4174974a318145d2dc6512457ea37241 (patch) | |
tree | ccb5c24cd5fcea626c59700b437e1b3d360af067 /activesupport/lib/active_support/core_ext/object | |
parent | ad93212f79e98535aa504dfdf6175e8035616abe (diff) | |
download | rails-27dbc27c4174974a318145d2dc6512457ea37241.tar.gz rails-27dbc27c4174974a318145d2dc6512457ea37241.tar.bz2 rails-27dbc27c4174974a318145d2dc6512457ea37241.zip |
Lazy-require CGI for Object#to_query
Diffstat (limited to 'activesupport/lib/active_support/core_ext/object')
-rw-r--r-- | activesupport/lib/active_support/core_ext/object/conversions.rb | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/core_ext/object/conversions.rb b/activesupport/lib/active_support/core_ext/object/conversions.rb index 1dee171ec4..278b856c45 100644 --- a/activesupport/lib/active_support/core_ext/object/conversions.rb +++ b/activesupport/lib/active_support/core_ext/object/conversions.rb @@ -1,5 +1,3 @@ -require 'cgi' - class Object # Alias of <tt>to_s</tt>. def to_param @@ -11,6 +9,7 @@ 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_s)}=#{CGI.escape(to_param.to_s)}" end end |