class Datamappify::Data::Criteria::Relational::Save

Public Instance Methods

perform() click to toggle source
# File lib/datamappify/data/criteria/relational/save.rb, line 6
def perform
  new_record? ? create_record : save_record unless ignore?
end

Private Instance Methods

create_record() click to toggle source
# File lib/datamappify/data/criteria/relational/save.rb, line 12
def create_record
  record = source_class.new(criteria)
  saved_record = save(record)

  update_entity_with(saved_record) if primary_record?

  record
end
update_entity_with(record) click to toggle source
# File lib/datamappify/data/criteria/relational/save.rb, line 21
def update_entity_with(record)
  entity.id = record.send(key_name)
end