Normal id in rails are incremental integers. The first Xxx ever created will have the id of 1, the next one of 2 etc… This way, it's really easy (for a hacker/bad person) to guess the url for the other resources. Using uuid as a primary key for each model will prevent this.
A uuid looks like this: 46c18abc-d96f-40da-a023-2ff0ed0bb6cf so your routes will look like: /models/46c18abc-d96f-40da-a023-2ff0ed0bb6cf
Why ?
Normal
id
in rails are incremental integers. The first Xxx ever created will have the id of 1, the next one of 2 etc… This way, it's really easy (for a hacker/bad person) to guess the url for the other resources. Using uuid as a primary key for each model will prevent this.A uuid looks like this:
46c18abc-d96f-40da-a023-2ff0ed0bb6cf
so your routes will look like:/models/46c18abc-d96f-40da-a023-2ff0ed0bb6cf
Todo
Follow this article. https://lab.io/articles/2017/04/13/uuids-rails-5-1/