thetron/mongoid_token — pull request #24 by dprater (2013-02-28 21:18:32+00:00)
Title: Fixes critical bug in collision-resolver code, adds prefix and suffix options.

This commit includes a fix for a bug I came across in the "resolve_token_collisions" method. In the current code, if a field other than the one being used by mongoid_token encounters a duplicate key error, the gem crashes because it attempts to "continue", which is not valid ruby. This update properly checks to see if the mongoid_token field is the one with the duplicate key - if it is, it handles it as before by attempting to regenerate the token. If the duplicate key error is not being caused by the field used by mongoid_token, it simply re-raises the error as it should, whereas before it was not taking any further action.

It also adds a prefix and suffix options that allow the user to specify a prefix and/or suffix to be added to each generated token. Added documentation and specs for updated code.