i'm editing a website (not made by me) and I don't undestand one thing.
Short intro
When an user create a new product page, in product.rb
, there is two validates
validates :title, presence: true
validates :slug, presence: true, uniqueness: true
The user can set only the title
of the product and the slug
(= the url) is generated automatically copying the title.
For example, if I set title: "Red", the page's url will be mysite.com/products/red
Now the question/problem
If I create a page with the same title of another page, the title will be always "Red" (because there is no uniqueness, obviously) but the slug (generated automatically) will be something like:
mysite.com/products/red-af503270-0ffd-4654-b4e9-a210e6a6500e
A very long url.
Why? I can't find the script that is making it.
Because I want to edit it to make the title progressive. For example mysite.com/products//red-2