diff options
author | Joshua Peek <josh@joshpeek.com> | 2009-12-02 15:07:01 -0600 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2009-12-02 15:08:42 -0600 |
commit | 1ee9b40b18a0bed5bb10a0785f7e2730bac983f6 (patch) | |
tree | fd89754db0e85dd65227fd07225a265c34a5b273 /activesupport/lib | |
parent | 49e943c4f0ac3459bd53023167aaa08fc8e46733 (diff) | |
download | rails-1ee9b40b18a0bed5bb10a0785f7e2730bac983f6.tar.gz rails-1ee9b40b18a0bed5bb10a0785f7e2730bac983f6.tar.bz2 rails-1ee9b40b18a0bed5bb10a0785f7e2730bac983f6.zip |
Failing tests for to_param/to_query not escaping "[]"
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/core_ext/object/to_param.rb | 2 | ||||
-rw-r--r-- | activesupport/lib/active_support/core_ext/object/to_query.rb | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/core_ext/object/to_param.rb b/activesupport/lib/active_support/core_ext/object/to_param.rb index a5e2260791..7ca763cbad 100644 --- a/activesupport/lib/active_support/core_ext/object/to_param.rb +++ b/activesupport/lib/active_support/core_ext/object/to_param.rb @@ -38,7 +38,7 @@ class Hash # ==== Examples # { :name => 'David', :nationality => 'Danish' }.to_query # => "name=David&nationality=Danish" # - # { :name => 'David', :nationality => 'Danish' }.to_query('user') # => "user%5Bname%5D=David&user%5Bnationality%5D=Danish" + # { :name => 'David', :nationality => 'Danish' }.to_query('user') # => "user[name]=David&user[nationality]=Danish" def to_param(namespace = nil) collect do |key, value| value.to_query(namespace ? "#{namespace}[#{key}]" : key) 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 3f1540f685..1c6a02c9ad 100644 --- a/activesupport/lib/active_support/core_ext/object/to_query.rb +++ b/activesupport/lib/active_support/core_ext/object/to_query.rb @@ -15,7 +15,7 @@ class Array # Converts an array into a string suitable for use as a URL query string, # using the given +key+ as the param name. # - # ['Rails', 'coding'].to_query('hobbies') # => "hobbies%5B%5D=Rails&hobbies%5B%5D=coding" + # ['Rails', 'coding'].to_query('hobbies') # => "hobbies[]=Rails&hobbies[]=coding" def to_query(key) prefix = "#{key}[]" collect { |value| value.to_query(prefix) }.join '&' |