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

Merge pull request #13306 from kassio/master

Fix mysql to support duplicated column names
This commit is contained in:
Rafael Mendonça França 2013-12-13 05:55:54 -08:00
commit 1713e8fe16
2 changed files with 9 additions and 4 deletions

View file

@ -419,14 +419,19 @@ module ActiveRecord
if result if result
types = {} types = {}
fields = []
result.fetch_fields.each { |field| result.fetch_fields.each { |field|
field_name = field.name
fields << field_name
if field.decimals > 0 if field.decimals > 0
types[field.name] = Fields::Decimal.new types[field_name] = Fields::Decimal.new
else else
types[field.name] = Fields.find_type field types[field_name] = Fields.find_type field
end end
} }
result_set = ActiveRecord::Result.new(types.keys, result.to_a, types)
result_set = ActiveRecord::Result.new(fields, result.to_a, types)
result.free result.free
else else
result_set = ActiveRecord::Result.new([], []) result_set = ActiveRecord::Result.new([], [])