Commit 2755fbc7cb47e4e6f0d872586dca33588d354e47

Authored by Steven Eksteen
1 parent b023f23c

Changes recommended by @nviennot

More exact ORM checking for NoBrainer and requiring
active_support/core_ext for the facet tests.
lib/searchkick/results.rb
... ... @@ -24,7 +24,7 @@ module Searchkick
24 24 hits.group_by{|hit, i| hit["_type"] }.each do |type, grouped_hits|
25 25 records = type.camelize.constantize
26 26 if options[:includes]
27   - if records.respond_to?(:preload)
  27 + if defined?(NoBrainer::Document) and records < NoBrainer::Document
28 28 records = records.preload(options[:includes])
29 29 else
30 30 records = records.includes(options[:includes])
... ...
test/facets_test.rb
1 1 require_relative "test_helper"
  2 +require "active_support/core_ext"
2 3  
3 4 class TestFacets < Minitest::Test
4 5  
... ...