diff --git a/app/models/person.rb b/app/models/person.rb index 0fa77b3d7..f8add5a52 100644 --- a/app/models/person.rb +++ b/app/models/person.rb @@ -100,10 +100,12 @@ class Person < ApplicationRecord # @return [Person::ActiveRecord_Relation] scope :find_by_substring, ->(search_str) { search_str.strip! - return none if search_str.blank? || search_str.size < 2 - - sql, tokens = search_query_string(search_str) - joins(:profile).where(sql, *tokens) + if search_str.blank? || search_str.size < 2 + none + else + sql, tokens = search_query_string(search_str) + joins(:profile).where(sql, *tokens) + end } # Left joins likes and comments to a specific post where people are authors of these comments and likes