There is a case when user should be able to manually change a slug for an object. For example let we have Page model with sluggable name field used to construct russian site urls. User creates a contact information page:
Page.create(:name => "Контактная информация")
Page slug will be "kontaktnaya-informaciya", but it is very difficult to remeber and read in translit. So, best variant is to change this slug manually to "contacts" during page creation.
I think, it will be useful to allow user to manually edit cached_slug field. The rule is simple: generate slug unless cached_slug_changed?, otherwise parameterize (convert) cached_slug and save.
Also, we should validate_uniqueness_of a slug, and may be add a sequence.
What do you think about it? I had implemented this, but I am not shure that it is elegant solution.
There is a case when user should be able to manually change a slug for an object. For example let we have Page model with sluggable name field used to construct russian site urls. User creates a contact information page:
Page.create(:name => "Контактная информация")
Page slug will be "kontaktnaya-informaciya", but it is very difficult to remeber and read in translit. So, best variant is to change this slug manually to "contacts" during page creation.
Page.create(:name => "Контактная информация", :slug_cache => "contacts")
I think, it will be useful to allow user to manually edit cached_slug field. The rule is simple: generate slug unless cached_slug_changed?, otherwise parameterize (convert) cached_slug and save.
Also, we should validate_uniqueness_of a slug, and may be add a sequence.
What do you think about it? I had implemented this, but I am not shure that it is elegant solution.