From 3de51462d4872111df77f1d7d0b2a991e2b7dc25 Mon Sep 17 00:00:00 2001 From: Andrew Kane Date: Tue, 17 Mar 2020 22:11:22 -0700 Subject: [PATCH] Fixed where [skip ci] --- lib/searchkick/relation.rb | 2 +- test/relation_test.rb | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/searchkick/relation.rb b/lib/searchkick/relation.rb index 1977957..7a8f757 100644 --- a/lib/searchkick/relation.rb +++ b/lib/searchkick/relation.rb @@ -34,7 +34,7 @@ module Searchkick opts = sanitize_opts(opts) if options[:where] - options[:where] = [{_and: [options[:where], opts]}] + options[:where] = {_and: [options[:where], opts]} else options[:where] = opts end diff --git a/test/relation_test.rb b/test/relation_test.rb index d541437..955e6c6 100644 --- a/test/relation_test.rb +++ b/test/relation_test.rb @@ -12,6 +12,11 @@ class RelationTest < Minitest::Test assert_equal ["Product A"], Product.search(relation: true).map(&:name) end + def test_where + store_names ["Product A", "Product B"] + assert_search_relation [], Product.search("*", relation: true).where(name: "Product A").where(name: "Product B") + end + def test_parameters skip unless defined?(ActiveRecord) require "action_controller" -- libgit2 0.21.0