godaddy/spree — pull request #8 by mtuckergd (2014-06-09 16:55:49+00:00)
Title: Enforce permalink uniqueness and rename on destroy to allow reuse

Added slug_candidates as a fallback, so friendly_id will attempt to append sku for auto-generated permalink if name-based value is already in use. This will generally not be used in Nemo itself, because we preset the slug and don't auto-generate, but it's useful for the base library.

Added unique validation of slug to the product model. The database has a unique index, so there is no reason this validation should not exist in the base model.

Restored 2.0 behavior of renaming the slug (permalink) on product destroy. This frees the value for reuse by another product. This piece may not be accepted by Spree, since they explicitly removed it in 2.2. If that is the case, we'll likely move that behavior up into our model override, as it is the behavior that we desire. For now, attempting to keep in the core library.

Part 1 of 2.
Other PR: