From 3652a39de0d40acad1f2b170c74338b4fda01359 Mon Sep 17 00:00:00 2001 From: alpaca-tc Date: Wed, 31 May 2017 22:10:26 +0900 Subject: [PATCH] Account.find_remote should be raise ActiveRecord::RecordNotFound (#3476) --- app/models/account.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/account.rb b/app/models/account.rb index f5ac8925..cb116dba 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -167,7 +167,7 @@ class Account < ApplicationRecord end def find_remote!(username, domain) - return if username.blank? + raise ActiveRecord::RecordNotFound if username.blank? where('lower(accounts.username) = ?', username.downcase).where(domain.nil? ? { domain: nil } : 'lower(accounts.domain) = ?', domain&.downcase).take! end