diff --git a/app/models/category.rb b/app/models/category.rb index 80b2a1a5c7d..0ee810e6410 100644 --- a/app/models/category.rb +++ b/app/models/category.rb @@ -230,7 +230,7 @@ SQL end # only allow to use category itself id. new_record doesn't have a id. unless new_record? - match_id = /(\d+)-category/.match(self.slug) + match_id = /^(\d+)-category/.match(self.slug) errors.add(:slug, :invalid) if match_id && match_id[1] && match_id[1] != self.id.to_s end end