to_query.rb 377 B

12345678910
  1. # ActiveSupport 3.0 doesn't URL-encode paths with arrays as params properly.
  2. # Backported from ActiveSupport > 3.0
  3. if ActiveSupport::VERSION::MAJOR == 3 && ActiveSupport::VERSION::MINOR == 0
  4. class Object
  5. def to_query(key)
  6. require 'cgi' unless defined?(CGI) && defined?(CGI::escape)
  7. "#{CGI.escape(key.to_param)}=#{CGI.escape(to_param.to_s)}"
  8. end
  9. end
  10. end