watu/random_unique_id — pull request #3 by dmagliola (2014-12-17 13:13:42+00:00)
Title: Added generation options: min_rid_length and UUID generation.

When dealing with enormous tables, checking for existence after generating can have a real performance penalty. Generating UUIDs means checking is not necessary.
Also, in some circumstances, someone might want to generate longer RIDs than 5 characters.

Added both configuration options which can be specified globally in a config, or at the model level.
The idea for global configuration is to have easy to use, easy to type RIDs in development, but long RIDs or UUIDs in production.
The idea for the model override is that some models may need these options, but for the rest the default is just fine.

Let me know if anything I did is un-Ruby-like and I'll correct it.

There are 2 things I'm not sure of:
- Storing the options in a Model instance-level method: random_unique_id_options. I don't like this much, but couldn't find any other way to do it.
- When testing the global configurations, I'm creating "fake classes" (Blog2 and Blog3) just to be able to call has_random_unique_id again after changing the global configuration. There may be a better way.