jobready/dataly — pull request #14 by andrewmcnamara (2014-09-16 00:29:55+00:00)
Title: Add additional parameter for CSV row to mapping functions.

This feature provides the ability for a mapping function to read values from the original CSV row.

Example use case :

When importing locations we need to set the correct suburb. To retrieve the correct suburb we need both the name and postcode. As the `Location` model only cares about the id of the suburb i.e. 'suburb_id', we need to provide a mechanism whereby we can pass additional parameters to locate the correct suburb.

```ruby
class LocationMapper < Dataly::Mapper
field :suburb_id, value: :suburb

def suburb(value,csv_row)
Suburb.where('lower(name) = ? and postcode = ?', value.downcase, csv_row[:postcode_id]).first
end
end