Module: Spree::Product::Slugs

Extended by:
ActiveSupport::Concern
Included in:
Spree::Product
Defined in:
app/models/spree/product/slugs.rb

Instance Method Summary collapse

Instance Method Details

#ensure_slug_is_unique(candidate_slug) ⇒ Object



57
58
59
60
61
62
# File 'app/models/spree/product/slugs.rb', line 57

def ensure_slug_is_unique(candidate_slug)
  return slug if candidate_slug.blank? || slug.blank?
  return candidate_slug if self.class.slug_available?(candidate_slug, id)

  normalize_friendly_id([candidate_slug, uuid_for_friendly_id])
end