From 44b15d7eb5f7a61b2b54c1acbbe1728d0a522ebc Mon Sep 17 00:00:00 2001 From: Andrew Kane Date: Tue, 17 Mar 2020 22:35:22 -0700 Subject: [PATCH] Fixed models --- lib/searchkick/relation.rb | 5 +++-- test/boost_test.rb | 1 - test/sql_test.rb | 2 -- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/searchkick/relation.rb b/lib/searchkick/relation.rb index d5a8b33..5c6bbf1 100644 --- a/lib/searchkick/relation.rb +++ b/lib/searchkick/relation.rb @@ -9,7 +9,7 @@ module Searchkick :took, :error, :model_name, :entry_name, :total_count, :total_entries, :current_page, :per_page, :limit_value, :total_pages, :num_pages, :offset_value, :previous_page, :prev_page, :next_page, :first_page?, :last_page?, - :out_of_range?, :hits, :response, :to_a, :first, :highlights + :out_of_range?, :hits, :response, :to_a, :first, :highlights, :group_by def_delegators :query, :body, :params @@ -404,7 +404,8 @@ module Searchkick end def spawn - Relation.new(klass, term, options.deep_dup) + # cannot deep dup due to model classes + Relation.new(klass, term, options.dup) end end end diff --git a/test/boost_test.rb b/test/boost_test.rb index 5642109..f96f756 100644 --- a/test/boost_test.rb +++ b/test/boost_test.rb @@ -238,7 +238,6 @@ class BoostTest < Minitest::Test assert_order "Rex", ["Rexx", "Rex"], {models: [Animal, Product], indices_boost: {Animal => 1, Product => 200}, fields: [:name]}, Searchkick - skip "Not working yet" assert_order_relation ["Rexx", "Rex"], Searchkick.search("Rex", relation: true).models(Animal, Product).indices_boost(Animal => 1, Product => 200).fields(:name) end end diff --git a/test/sql_test.rb b/test/sql_test.rb index f2e7224..8e0e873 100644 --- a/test/sql_test.rb +++ b/test/sql_test.rb @@ -256,8 +256,6 @@ class SqlTest < Minitest::Test assert records.first.association(associations[klass].first).loaded? end - skip "Not working yet" - result = Searchkick.search("*", relation: true).models(Product, Store).model_includes(associations) assert_equal 2, result.length result.group_by(&:class).each_pair do |klass, records| -- libgit2 0.21.0