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

@ -312,7 +312,7 @@ class UsersController < ApplicationController
# [LEGACY] avatars in quotes/oneboxes might still be pointing to this route
# fixing it requires a rebake of all the posts
def avatar
user = User.where(username_lower: params[:username].downcase).first
user = User.find_by(username_lower: params[:username].downcase)
if user.present?
size = determine_avatar_size(params[:size])
url = user.avatar_template.gsub("{size}", size.to_s)