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:
parent
883fa8f938
commit
da400fbb0b
1 changed files with 9 additions and 6 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue