1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Freeze columns only once per Result

This commit is contained in:
Santiago Pastorino 2012-09-20 12:59:31 -03:00
parent 883fa8f938
commit da400fbb0b

View file

@ -53,12 +53,15 @@ module ActiveRecord
private
def hash_rows
@hash_rows ||= @rows.map { |row|
@hash_rows ||=
begin
# We freeze the strings to prevent them getting duped when
# used as keys in ActiveRecord::Model's @attributes hash
columns = @columns.map { |c| c.freeze }
columns = @columns.map { |c| c.dup.freeze }
@rows.map { |row|
Hash[columns.zip(row)]
}
end
end
end
end