From 2755fbc7cb47e4e6f0d872586dca33588d354e47 Mon Sep 17 00:00:00 2001 From: Steven Eksteen Date: Fri, 14 Nov 2014 09:20:10 +0200 Subject: [PATCH] Changes recommended by @nviennot --- lib/searchkick/results.rb | 2 +- test/facets_test.rb | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/searchkick/results.rb b/lib/searchkick/results.rb index fa9bb92..637486c 100644 --- a/lib/searchkick/results.rb +++ b/lib/searchkick/results.rb @@ -24,7 +24,7 @@ module Searchkick hits.group_by{|hit, i| hit["_type"] }.each do |type, grouped_hits| records = type.camelize.constantize if options[:includes] - if records.respond_to?(:preload) + if defined?(NoBrainer::Document) and records < NoBrainer::Document records = records.preload(options[:includes]) else records = records.includes(options[:includes]) diff --git a/test/facets_test.rb b/test/facets_test.rb index 35954c1..20cf18f 100644 --- a/test/facets_test.rb +++ b/test/facets_test.rb @@ -1,4 +1,5 @@ require_relative "test_helper" +require "active_support/core_ext" class TestFacets < Minitest::Test -- libgit2 0.21.0