Merge pull request #2316 from mutiny/refactor-where-first

Refactor `where(...).first` to `find_by(...)`
This commit is contained in:
Sam
2014-05-08 09:10:45 +10:00
104 changed files with 204 additions and 213 deletions

View File

@ -197,12 +197,12 @@ module Discourse
# Either returns the site_contact_username user or the first admin.
def self.site_contact_user
user = User.where(username_lower: SiteSetting.site_contact_username.downcase).first if SiteSetting.site_contact_username.present?
user = User.find_by(username_lower: SiteSetting.site_contact_username.downcase) if SiteSetting.site_contact_username.present?
user ||= User.admins.real.order(:id).first
end
def self.system_user
User.where(id: -1).first
User.find_by(id: -1)
end
def self.store