4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ハッシュをURLのパラメータに変換

Posted at
  foo_hash.each_pair.map{ |x,y|
    "#{x}=#{CGI.escape(y)}"
  }.join("&")

URI::encodeみたいなのはRuby1.9からは推奨されていない
下記3つも使える

  • CGI.escape
  • URI.www_form_encode
  • URI.www_form_encode_component
4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?