解决用户登录名的.号问题

This commit is contained in:
huang 2016-11-14 16:33:49 +08:00
parent 695ce6c2e4
commit 2b1a73e692
1 changed files with 2 additions and 1 deletions

View File

@ -323,8 +323,9 @@ class User < Principal
# id 转换成 登录名 # id 转换成 登录名
# 如果是整数就去ID否则就取login # 如果是整数就去ID否则就取login
# 含有特殊符号的则显示ID
def to_param def to_param
self.login.to_i.to_s == self.login ? id : login (self.login.to_i.to_s == self.login || self.login.include?(".") || self.login.include?("%") || self.login.include?("?")) ? id : login
end end