Use ActiveRecord Column#type_cast to properly parse fields represented by a string.

Fixed issued reported by Nick Burdick where imported datetime fields was not correctly working with certain string formats for MySQL which doesn't support MM/DD/YYYY format directly.
This commit is contained in:
Zach Dennis 2011-01-05 19:05:31 -05:00
parent 8e266f74f7
commit 8fbf841fde
3 changed files with 15 additions and 2 deletions

View file

@ -129,7 +129,8 @@ module ActiveRecord::Import::AbstractAdapter
array_of_attributes.each do |arr|
my_values = []
arr.each_with_index do |val,j|
my_values << quote( val, columns[j] )
importable_value = columns[j].type_cast(val)
my_values << quote(importable_value, columns[j] )
end
values << my_values
end