From 41fbfb40d89e76af8e47093237039a9887541612 Mon Sep 17 00:00:00 2001 From: Vipul A M Date: Sat, 4 May 2013 00:24:34 +0530 Subject: use destructive sort on array in Hash#to_param for performance gains. Check https://gist.github.com/vipulnsward/6aad158c06a22f931a71 to see the gains. --- activesupport/lib/active_support/core_ext/object/to_param.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activesupport/lib/active_support') 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 -- cgit v1.2.3