Class: Topographer::Importer::Strategy::ImportNewRecord
- Defined in:
- lib/topographer/importer/strategy/import_new_record.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
#failure_message, #initialize, #should_persist_import?, #success_message
Constructor Details
This class inherits a constructor from Topographer::Importer::Strategy::Base
Instance Method Details
#import_record(source_data) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 |
# File 'lib/topographer/importer/strategy/import_new_record.rb', line 3 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. status = get_import_status(mapping_result, model_errors) new_model.save if should_persist_import?(status) status end |