README.md in csv_row_model-0.3.3 vs README.md in csv_row_model-0.3.4
- old
+ new
@@ -122,11 +122,11 @@
def original_attribute(column_name)
# 1. Get the raw CSV string value for the column
value = mapped_row[column_name]
# 2. Clean or format each cell
- value = self.class.format_cell(cell, column_name, column_index)
+ value = self.class.format_cell(cell, column_name, column_index, context)
if value.present?
# 3a. Parse the cell value (which does nothing if no parsing is specified)
parse(value)
elsif default_exists?
@@ -144,10 +144,10 @@
Override the `format_cell` method to clean/format every cell:
```ruby
class ProjectImportRowModel < ProjectRowModel
include CsvRowModel::Import
class << self
- def format_cell(cell, column_name, column_index)
+ def format_cell(cell, column_name, column_index, context={})
cell = cell.strip
cell.blank? ? nil : cell
end
end
end
\ No newline at end of file