Class: ActiveRecord::ConnectionAdapters::Mysql2Adapter

Inherits:
Object
  • Object
show all
Defined in:
lib/activerecord-mysql2-adapter-patch.rb

Instance Method Summary collapse

Instance Method Details

#each_hash(result) ⇒ Object

:nodoc:



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/activerecord-mysql2-adapter-patch.rb', line 7

def each_hash(result) # :nodoc:
  if block_given?
    result.each(as: :hash, symbolize_keys: true) do |row|
      if row[:Type] == 'datetime' && row[:Extra] != ''
        row[:Default] += ' ' + row[:Extra]
        row[:Extra] = ''
      end
      yield row
    end
  else
    to_enum(:each_hash, result)
  end
end