You mean something like this (for MySQL): ALTER TABLE `foo` ADD `slug` CHAR(9) UNIQUE; UPDATE `foo` SET `slug` = MD5(RAND());
Assumes MySQL - but most modern DBs should have something similar. On Dec 28, 2009, at 7:03 PM, Scott Olmsted wrote: > > My client wants to expose some report pages to users without them having to > sign in. I suggested using a URL with a random slug, such as > > http://www.clientsite.com/report/3hf84hgiw > > There are lots of such pages in the app now with the record id in the URL, > accessible only if signed in. > > I could add some code and a rake task to generate random slugs for existing > records, or hack one of the many slug-generating plugins, but maybe someone > has a better suggestion. > > Thanks, > > Scott > > -- > SD Ruby mailing list > [email protected] > http://groups.google.com/group/sdruby -- SD Ruby mailing list [email protected] http://groups.google.com/group/sdruby
