diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-12-13 05:55:54 -0800 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-12-13 05:55:54 -0800 |
commit | 1713e8fe16176fa24ece92180f2599f938ec9608 (patch) | |
tree | e0232f5521f22dbf42149442efb220bc91586ba1 /activerecord/lib/active_record | |
parent | 63f9a7507b0621c2b7eadc05a3f087e0d453c14f (diff) | |
parent | b8569b9337309c2d6c72566a3426994b6da443d7 (diff) | |
download | rails-1713e8fe16176fa24ece92180f2599f938ec9608.tar.gz rails-1713e8fe16176fa24ece92180f2599f938ec9608.tar.bz2 rails-1713e8fe16176fa24ece92180f2599f938ec9608.zip |
Merge pull request #13306 from kassio/master
Fix mysql to support duplicated column names
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/mysql_adapter.rb | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb b/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb index c4dcba0501..760f1435eb 100644 --- a/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb @@ -419,14 +419,19 @@ module ActiveRecord if result types = {} + fields = [] result.fetch_fields.each { |field| + field_name = field.name + fields << field_name + if field.decimals > 0 - types[field.name] = Fields::Decimal.new + types[field_name] = Fields::Decimal.new else - types[field.name] = Fields.find_type field + types[field_name] = Fields.find_type field end } - result_set = ActiveRecord::Result.new(types.keys, result.to_a, types) + + result_set = ActiveRecord::Result.new(fields, result.to_a, types) result.free else result_set = ActiveRecord::Result.new([], []) |