Account.find_remote should be raise ActiveRecord::RecordNotFound (#3476)

master
alpaca-tc 8 years ago committed by Eugen Rochko
parent 79335e46fd
commit 3652a39de0
  1. 2
      app/models/account.rb

@ -167,7 +167,7 @@ class Account < ApplicationRecord
end end
def find_remote!(username, domain) 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! where('lower(accounts.username) = ?', username.downcase).where(domain.nil? ? { domain: nil } : 'lower(accounts.domain) = ?', domain&.downcase).take!
end end

Loading…
Cancel
Save