Hi all. I’m importing some legacy data via ActiveRecord. However, it has
no primary key and I don’t want duplicates - I am reasonably sure the
combination of two certain fields are unique, though.
What’s the best practice & how’s it done pls?
-
Make a string id field and concatenate the two fields (or whatever I
want for an ID) in it -
Set the two fields to be primary keys, Rails picks it up, and don’t
use find() -
Manually check with find_or_create_by_name_and_date(params) for each
record -
Something else…
Thx!