Hello, using MySQL, FasterCSV and have a CSV dump of blog posts to be imported as production data, except the created_at and updated_at columns are always populated for me and not read from the CSV!
I tried renaming the columns, tried changing the type to import them as strings, this worked (as strings), but then when I changed the type to datetime, they NULL'd out (expected?).
This happens for all my models that use the timestamp columns. All tables were created from migrations using t.timestamps.
I tried messing with record_timestamps as well to no avail. this must be a general problem, hoping it's something simple. tia!
def import_csv(file) name = File.basename(file, '.csv') puts puts "truncating existing #{name} data..." ActiveRecord::Base.connection.execute("truncate table #{name.pluralize.underscore}")
puts "parsing #{name}.csv..." rows = FasterCSV.read(file, :quote_char => '\\') column_names = rows.shift
puts "importing #{rows.size} rows..." count = (eval "#{name}.import(column_names, rows)").num_inserts
puts "successfully imported #{count} rows!" puts end