From 2f5ce553e20834a4b44ee57c4d592fc6813d4ff7 Mon Sep 17 00:00:00 2001 From: alan <547533434@qq.com> Date: Mon, 14 Mar 2016 10:46:02 +0800 Subject: [PATCH] refactor user find --- app/models/user.rb | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index 259b9d04e..779566ea8 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1066,14 +1066,13 @@ class User < Principal # refactor User model find function, # return anonymous user when can not find user id = user_id - def self.find user_id - user = User.new + def self.find (*args, &block) begin - user = super + super rescue - user = self.anonymous + self.anonymous end - user + # super end # Salts all existing unsalted passwords # It changes password storage scheme from SHA1(password) to SHA1(salt + SHA1(password))