-
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When two or more models are defined with the same prefix, `PrefixedIds.find` will load the model for whichever one was defined last, and could lead to loading an unexpected model for a given prefixed id. For apps with lots of models it’s quite easy to add the same prefix on two or more models by mistake. It’s also not obvious how to access or list the prefixes already in use, so I think it makes sense for the gem to protect against this. This PR adds a check when calling `has_prefix_id` and raises `PrefixedIds::Error` if the same prefix was already defined for a different model.
- Loading branch information
Showing
2 changed files
with
33 additions
and
1 deletion.
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