mirror of
https://github.com/discourse/discourse.git
synced 2025-06-05 08:07:17 +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:
@ -72,9 +72,9 @@ class TopicCreator
|
||||
# When all clients are updated the category variable should
|
||||
# be set directly to the contents of the if statement.
|
||||
if (@opts[:category].is_a? Integer) || (@opts[:category] =~ /^\d+$/)
|
||||
Category.where(id: @opts[:category]).first
|
||||
Category.find_by(id: @opts[:category])
|
||||
else
|
||||
Category.where(name: @opts[:category]).first
|
||||
Category.find_by(name: @opts[:category])
|
||||
end
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user