Fix #5267: order[custom] no longer works when only a single ID is being searched

This commit is contained in:
evazion
2022-09-29 03:36:55 -05:00
parent 530d8cf762
commit d629c81aa1
3 changed files with 11 additions and 2 deletions

View File

@@ -249,8 +249,9 @@ module Searchable
# Post.order_custom("1,2,3") => [post #1, post #2, post #3]
def order_custom(string)
operator, ids = RangeParser.parse(string, :integer)
return none unless operator == :in
return none unless operator in :in | :eq
ids = Array.wrap(ids)
in_order_of(:id, ids)
rescue RangeParser::ParseError
none