Throwing a RecordNotFound exception when a record is scanned using the
inverse_of option. I've also refactored the code for raising a
RecordNotFound exception when searching for records with ids.