1
0
Fork 0
mirror of https://github.com/activerecord-hackery/ransack.git synced 2022-11-09 13:47:45 -05:00

Use Hash#each_key instead of Hash#keys.each

Hash#keys.each allocates an array of keys.

Hash#each_key iterates through the keys without allocating a
new array and as such is a better, more specific tool for the
job.
This commit is contained in:
Jon Atack 2014-12-01 23:40:22 +01:00
parent e2fcff3b13
commit ee571fe9a2

View file

@ -152,7 +152,7 @@ module Ransack
end
def collapse_multiparameter_attributes!(attrs)
attrs.keys.each do |k|
attrs.each_key do |k|
if k.include?(Constants::LEFT_PARENTHESIS)
real_attribute, position = k.split(/\(|\)/)
cast =