I'm importing legacy data into a new application, and there are duplicate entries for users.
I need to clean up this data (remove the duplicates), but I'm worried that those user ids may be referenced in other places.
I was hoping to write something in the model to catch any not found exceptions and return the correct id for the record in the event that one of the deleted (duplicate) ids are referenced.
Everything I'm seeing in google is a rescue used in conjunction with a Find statement in controllers. I don't want to have to litter my code with rescue statements in every single find statement I write.
Is there a way to rescue from ActiveRecord::RecordNotFound in the model? I'd need the offending ID in the method for reference.