名字为空的用户创建博客时博客名称为登录名
This commit is contained in:
parent
b0aee8c92f
commit
c4816a0414
|
@ -260,7 +260,7 @@ class User < Principal
|
|||
@blog = Blog.where("author_id = #{self.id}").all[0]
|
||||
if @blog.nil?
|
||||
#如果某个user的blog不存在,那么就创建一条,并且跳转
|
||||
@blog = Blog.create(:name=>(User.find(self.id).realname),
|
||||
@blog = Blog.create(:name=>(User.find(self.id).realname.blank? ? User.find(self.id).login : User.find(self.id).realname ),
|
||||
:description=>'',
|
||||
:author_id=>self.id)
|
||||
@blog.save
|
||||
|
|
Loading…
Reference in New Issue