Ticket #900 (closed enhancement: fixed)
Sluggable template does not generate unique slugs
| Reported by: | jphilip | Owned by: | somebody |
|---|---|---|---|
| Priority: | major | Milestone: | 0.10.4 |
| Component: | Other | Version: | 0.10.0 |
| Severity: | Keywords: | ||
| Cc: | Has Test: | ||
| Status: | Has Patch: |
Description
This is an enhanced version of the sluggable template, it adds a few options:
unique: true (The default) Generates a unique slug by adding incremental -xxx at the end uniqueBy: [field1, field2...] Generates a unique slug but allow the same slug when field1, field2 are the same uniqueIndex: true (The default) Generates a unique index in the table for the slug (The index is based on the field of the name option, plus the uniqueBy fields)
- Also when the option fields is empty and a method named getUniqueSlug exits in the model, it is used to generate the slug.
- Also works to make the slug unique when it is set manually or updated by a user.
The test case joined has 27 tests that pass.