mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 23:36:11 +08:00
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:
@ -25,9 +25,9 @@ class SearchController < ApplicationController
|
||||
# A user is found by username
|
||||
context_obj = nil
|
||||
if search_context[:type] == 'user'
|
||||
context_obj = klass.where(username_lower: params[:search_context][:id].downcase).first
|
||||
context_obj = klass.find_by(username_lower: params[:search_context][:id].downcase)
|
||||
else
|
||||
context_obj = klass.where(id: params[:search_context][:id]).first
|
||||
context_obj = klass.find_by(id: params[:search_context][:id])
|
||||
end
|
||||
|
||||
guardian.ensure_can_see!(context_obj)
|
||||
|
Reference in New Issue
Block a user