Perform the where(...).first to find_by(...) refactoring.

This refactoring was automated using the command: bundle exec "ruby refactorings/where_dot_first_to_find_by/app.rb"
This commit is contained in:
Louis Rose
2014-05-06 14:41:59 +01:00
parent f1369e4503
commit 1574485443
104 changed files with 204 additions and 213 deletions

View File

@ -79,7 +79,7 @@ module Import
end
def ensure_we_have_a_user
user = User.where(id: @user_id).first
user = User.find_by(id: @user_id)
raise Discourse::InvalidParameters.new(:user_id) unless user
# keep some user data around to check them against the newly restored database
@user_info = { id: user.id, username: user.username, email: user.email }
@ -280,7 +280,7 @@ module Import
end
def notify_user
if user = User.where(email: @user_info[:email]).first
if user = User.find_by(email: @user_info[:email])
log "Notifying '#{user.username}' of the end of the restore..."
# NOTE: will only notify if user != Discourse.site_contact_user
if @success