Remove return in scope block
Return in scope fails with `LocalJumpError: unexpected return`
This commit is contained in:
parent
150fea6edb
commit
4bbc51bfb9
1 changed files with 6 additions and 4 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue