Commit b2d0cd7f73f9727960940e42a70229fb07af478f
1 parent
dd4c1234
Exists in
master
and in
20 other branches
Better error message when no primary key - closes #779
Showing
2 changed files
with
2 additions
and
5 deletions
Show diff stats
.travis.yml
lib/searchkick/results.rb
... | ... | @@ -205,13 +205,10 @@ module Searchkick |
205 | 205 | if records.respond_to?(:primary_key) && records.primary_key |
206 | 206 | # ActiveRecord |
207 | 207 | records.where(records.primary_key => ids) |
208 | - elsif records.respond_to?(:all) && records.all.respond_to?(:for_ids) | |
209 | - # Mongoid 2 | |
210 | - records.all.for_ids(ids) | |
211 | 208 | elsif records.respond_to?(:queryable) |
212 | 209 | # Mongoid 3+ |
213 | 210 | records.queryable.for_ids(ids) |
214 | - elsif records.respond_to?(:unscoped) && [:preload, :eager_load].any? { |m| records.all.respond_to?(m) } | |
211 | + elsif records.respond_to?(:unscoped) && :id.respond_to?(:in) | |
215 | 212 | # Nobrainer |
216 | 213 | records.unscoped.where(:id.in => ids) |
217 | 214 | else | ... | ... |