From c4816a04143a9b3c8849b5fae76afe98bc97479c Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 30 Oct 2015 09:56:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8D=E5=AD=97=E4=B8=BA=E7=A9=BA=E7=9A=84?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=88=9B=E5=BB=BA=E5=8D=9A=E5=AE=A2=E6=97=B6?= =?UTF-8?q?=E5=8D=9A=E5=AE=A2=E5=90=8D=E7=A7=B0=E4=B8=BA=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/user.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/user.rb b/app/models/user.rb index b75b67a1a..e68fc7d8e 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -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