The following code that is inserting new rows correctly if people
isn't found. If people
is found I want it to update existing row and also the import_id
but the update isn't working. So basically if a new import contains the same data in people
I want to just update import_id
. people
has name age
.
Person.transaction do
people.flatten.each do |people|
Person.create_with({ import_id: import.id, **people }).find_or_create_by(**people)
end
end
Aucun commentaire:
Enregistrer un commentaire