diff options
author | Vipul A M <vipulnsward@gmail.com> | 2013-05-04 00:24:34 +0530 |
---|---|---|
committer | Vipul A M <vipulnsward@gmail.com> | 2013-05-05 21:59:24 +0530 |
commit | 41fbfb40d89e76af8e47093237039a9887541612 (patch) | |
tree | 8cfc4fb2ac0af812e1b83ac5672b6db9de8bf2ec /activesupport/lib/active_support | |
parent | 9a4268db99d93190c58bddcb150832727a0d5129 (diff) | |
download | rails-41fbfb40d89e76af8e47093237039a9887541612.tar.gz rails-41fbfb40d89e76af8e47093237039a9887541612.tar.bz2 rails-41fbfb40d89e76af8e47093237039a9887541612.zip |
use destructive sort on array in Hash#to_param for performance gains.
Check https://gist.github.com/vipulnsward/6aad158c06a22f931a71 to see the gains.
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r-- | activesupport/lib/active_support/core_ext/object/to_param.rb | 2 |
1 files changed, 1 insertions, 1 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 0d5f3501e5..3b137ce6ae 100644 --- a/activesupport/lib/active_support/core_ext/object/to_param.rb +++ b/activesupport/lib/active_support/core_ext/object/to_param.rb @@ -53,6 +53,6 @@ class Hash def to_param(namespace = nil) collect do |key, value| value.to_query(namespace ? "#{namespace}[#{key}]" : key) - end.sort * '&' + end.sort! * '&' end end |