Skip to content

Commit 049a2db

Browse files
committed
Flattened where options
1 parent a9eb55f commit 049a2db

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/searchkick/relation.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -575,11 +575,12 @@ def where!(value)
575575
check_loaded
576576
value = ensure_permitted(value)
577577
if @options[:where]
578+
if @options[:where][:_and].is_a?(Array)
579+
merge_option(:where, {_and: @options[:where][:_and] + [value]})
578580
# keep simple when possible for smart aggs
579-
if !@options[:where].keys.intersect?(value.keys)
581+
elsif !@options[:where].keys.intersect?(value.keys)
580582
merge_option(:where, value)
581583
else
582-
# TODO flatten
583584
@options[:where] = {_and: [@options[:where], value]}
584585
end
585586
else

0 commit comments

Comments
 (0)