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:
parent
8e266f74f7
commit
8fbf841fde
3 changed files with 15 additions and 2 deletions
|
@ -257,7 +257,7 @@ class ActiveRecord::Base
|
|||
def import_without_validations_or_callbacks( column_names, array_of_attributes, options={} )
|
||||
escaped_column_names = quote_column_names( column_names )
|
||||
columns = []
|
||||
array_of_attributes.first.each_with_index { |arr,i| columns << columns_hash[ column_names[i] ] }
|
||||
array_of_attributes.first.each_with_index { |arr,i| columns << columns_hash[ column_names[i].to_s ] }
|
||||
|
||||
if not supports_import?
|
||||
columns_sql = "(" + escaped_column_names.join( ',' ) + ")"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue