about summary refs log tree commit diff
path: root/app/models/account.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/account.rb')
-rw-r--r--app/models/account.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/models/account.rb b/app/models/account.rb
index e4295d735..06f858c7c 100644
--- a/app/models/account.rb
+++ b/app/models/account.rb
@@ -104,6 +104,12 @@ class Account < ActiveRecord::Base
     self.where(table[:username].matches(username)).where(domain: nil).take!
   end
 
+  def self.find_local(username)
+    self.find_local!(username)
+  rescue ActiveRecord::RecordNotFound
+    nil
+  end
+
   before_create do
     if local?
       keypair = OpenSSL::PKey::RSA.new(Rails.env.test? ? 1024 : 2048)