Thank you once again for all the advice and feedback on this thread -
I've found just reading about all the different methods fascinating
and very interesting.

Just to let you know that this is the method that I implemented in the
end:

    property :short-url,   Text, :default => Proc.new { |r, p|
(r.id.to_s+rand(9).to_s+(1+rand(8)).to_s).reverse.to_i.to_s(36) }

This generates unique keys (based on the DB id) and only after the id
is in the billions does it start to use more than 8 digits.
You also only have a 1 in 90 chance of 'guessing' a random sequence of
letters and getting an actual url (due to random numbers being used),
which would hopefully put off people casually trying to guess urls.

This fulfils what I wanted to do. I'm sure it's not industrial-
strength but it will do for now.

Thanks again,

DAZ





On Mar 14, 8:18 am, Duncan <[email protected]> wrote:
> You can use a sequense on DB end convert for the URL to base27 (A-Z + 0)
> long 8 characters?
>
> Sorry for my english

-- 
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en.

Reply via email to