lib/loaders/excel_loader.rb in datashift-0.2.2 vs lib/loaders/excel_loader.rb in datashift-0.4.0
- old
+ new
@@ -78,17 +78,21 @@
# This is rubbish but currently manually detect when actual data ends, this isn't very smart but
# got no better idea than ending once we hit the first completely empty row
break if @excel.sheet.getRow(row).nil?
contains_data = false
+
+ # First assign any default values for columns not included in parsed_file
+ process_missing_columns_with_defaults
+
# TODO - Smart sorting of column processing order ....
# Does not currently ensure mandatory columns (for valid?) processed first but model needs saving
# before associations can be processed so user should ensure mandatory columns are prior to associations
# as part of this we also attempt to save early, for example before assigning to
# has_and_belongs_to associations which require the load_object has an id for the join table
-
+
# Iterate over the columns method_mapper found in Excel,
# pulling data out of associated column
@method_mapper.method_details.each_with_index do |method_detail, col|
value = value_at(row, col)
\ No newline at end of file