This repository has been archived by the owner on Sep 27, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The use of ActiveRecord's #find meant missing IDs raised AR::RecordNotFound. This might come up if an object was created and then deleted without its trigram data also being deleted. To avoid the exception this uses #where instead of #find which will ignore missing results. Due to the method with which the records are sorted to match the trigram query, in these cases nils were cropping up in the results, so this uses #compact to just return the records. The first test case ensures no exceptions are raised. The second test case ensures the fuzzy find still works and that no nils are returned.
- Loading branch information
Showing
2 changed files
with
19 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters