Commit 8fa1bd5617873c2b596e89fba0a8d69404df240a
1 parent
ad738dea
Exists in
relation
and in
1 other branch
Test where [skip ci]
Showing
2 changed files
with
2 additions
and
1 deletions
Show diff stats
lib/searchkick/relation.rb
@@ -232,7 +232,7 @@ module Searchkick | @@ -232,7 +232,7 @@ module Searchkick | ||
232 | 232 | ||
233 | # TODO merge options | 233 | # TODO merge options |
234 | def aggs!(*args) | 234 | def aggs!(*args) |
235 | - options[:aggs] = args | 235 | + options[:aggs] = args.size == 1 ? args.first : args |
236 | self | 236 | self |
237 | end | 237 | end |
238 | 238 |
test/aggs_test.rb
@@ -18,6 +18,7 @@ class AggsTest < Minitest::Test | @@ -18,6 +18,7 @@ class AggsTest < Minitest::Test | ||
18 | 18 | ||
19 | def test_where | 19 | def test_where |
20 | assert_equal ({1 => 1}), store_agg(aggs: {store_id: {where: {in_stock: true}}}) | 20 | assert_equal ({1 => 1}), store_agg(aggs: {store_id: {where: {in_stock: true}}}) |
21 | + assert_equal ({1 => 1}), buckets_as_hash(Product.search("Product", relation: true).aggs(store_id: {where: {in_stock: true}}).aggs["store_id"]) | ||
21 | end | 22 | end |
22 | 23 | ||
23 | def test_order | 24 | def test_order |