mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 10:50:21 +08:00
Move logic to reject slugs that are just numbers into the slug module
This commit is contained in:
parent
7d5c313456
commit
b82a5dfd56
3 changed files with 10 additions and 4 deletions
|
@ -6,7 +6,8 @@
|
|||
module Slug
|
||||
|
||||
def self.for(string)
|
||||
string.parameterize.gsub("_", "-")
|
||||
slug = string.parameterize.gsub("_", "-")
|
||||
slug =~ /[^\d]/ ? slug : '' # Reject slugs that only contain numbers, because they would be indistinguishable from id's.
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue