Sha256: 400bb62507d1acba88d1ece80467e740cb2f38dcd59a395b7dcc72c073112464

Contents?: true

Size: 559 Bytes

Versions: 2

Compression:

Stored size: 559 Bytes

Contents

module Topographer
  class Importer
    module Strategy
      class ImportNewRecord < Topographer::Importer::Strategy::Base

        def import_record (source_data)
          mapping_result = mapper.map_input(source_data)
          new_model = mapper.model_class.new(mapping_result.data)
          new_model.valid?
          model_errors = new_model.errors.full_messages
          status = get_import_status(mapping_result, model_errors)

          new_model.save if should_persist_import?(status)

          status
        end

      end
    end
  end
end


Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
topographer-0.0.9 lib/topographer/importer/strategy/import_new_record.rb
topographer-0.0.8 lib/topographer/importer/strategy/import_new_record.rb