Generate a unique token with Active Record. Also a nice example of a Ruby Gem.
Allen Walker
gem "auswalk-uniquify", "~> 1.0.0"