Custom value for category slug

(Jason May) #1

I will have a large number of categories (thousands). Some of the categories will have long names and/or similar names.

I propose that an API client would be able submit an optional value for the slug when creating a new category. If provided, uniqueness on that value would be checked and the internal slug generation would be skipped.

Also, allow for changing the slug via API.

Is this reasonable? Are there other functions that might break if slugs can be overridden or changed?

(ying) #2

i like this too. If i can change the category slug manualy, there will be more friendly.

(Erick Guan) #3

Category is found by the id instead of not slug. And why unique slug name if you can manually control them?

(Jason May) #4

Category is retrieved by slug first, then id if slug does not match. See CategoriesController#fetch_category.

Slug cannot be changed through the UI. Uniqueness of slug is enforced when a category is created (see Category#ensure_slug). If we allow for changing the slug later through the API, we must ensure that it remains unique.

(Erick Guan) #5

I would like to implement as accepting the optional slug param.

  1. slug param exists and valid: use the provided
  2. slug param exists but invalid: use the default
  3. slug param not exists: use the default

And also a slug api.