I am writing a rails app with a Person model that looks something like this:
create_table "people", :force => true do |t|
t.string "first_name"
t.string "last_name"
t.string "email"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
I have a two step process as follows:
- Fill out person records, with the names of people. The names of people may have unkown duplicates, due to nicknames, etc. For example, "tim smith" and "timothy smith"
- Query an API to get potential email address matches for those people.
After doing that processing, I could have data like:
record 1: first_name: tim last_name: smith email: tim.smith@sampleemail.com
record 2: first_name: timothy last_name: smith email: tim.smith@sampleemail.com
What's the best way in rails to model that those are duplicates?
UPDATE: CLARIFICATION
After step 2, I know how to find out that those two records are duplicates (i.e. the same person), my question is how to represent that in the model? Should I add a "duplicate_of_person_id" type field and put the id of the first record in that field in the second record? Is there a better way?