samedi 4 juin 2016

How to obfuscate user id with random number using friendly_id

When my new website launches there will be very few users. Currently a user's profile page is /users/:id so in the early stages it will be /users/6, etc. I don't want others to know how many users the website has. I think that an long id (such as a uuid) with numbers and letters looks ugly so I would prefer it just be numbers.

How can I use friendly_id gem to create a random number slug that will also be unique? This is also my first website so any "best practices" tips regarding user id obfuscation would be helpful. Thanks.




Aucun commentaire:

Enregistrer un commentaire