I want to do the same thing as explained in this question How to write Rake task to import data to Rails app?.
However, i am not satisfied with the accepted answer because it does not consider deleted items in the source.
What is the simplest, most rails conform way to go about this with considering deleted entries in the source?
Notes:
- When using .find_or_initialize_by_identifier and never deleting, excess entries remain in the table.
- When using .delete_all before each import, as far as i know, the primary key is not reset and approaches its limit quickly.
- I could drop the table and use ::Migrations.create_table in the rake task but then the definitions in the schema and migrations must be kept in sync with the code in the rake task, which seems undesirable.