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
@@ -26,7 +26,7 @@ matrix: | @@ -26,7 +26,7 @@ matrix: | ||
26 | env: ELASTICSEARCH_VERSION=2.0.0 | 26 | env: ELASTICSEARCH_VERSION=2.0.0 |
27 | jdk: oraclejdk7 | 27 | jdk: oraclejdk7 |
28 | - gemfile: Gemfile | 28 | - gemfile: Gemfile |
29 | - env: ELASTICSEARCH_VERSION=2.4.1 | 29 | + env: ELASTICSEARCH_VERSION=2.4.3 |
30 | jdk: oraclejdk7 | 30 | jdk: oraclejdk7 |
31 | - gemfile: Gemfile | 31 | - gemfile: Gemfile |
32 | env: ELASTICSEARCH_VERSION=5.0.1 | 32 | env: ELASTICSEARCH_VERSION=5.0.1 |
lib/searchkick/results.rb
@@ -205,13 +205,10 @@ module Searchkick | @@ -205,13 +205,10 @@ module Searchkick | ||
205 | if records.respond_to?(:primary_key) && records.primary_key | 205 | if records.respond_to?(:primary_key) && records.primary_key |
206 | # ActiveRecord | 206 | # ActiveRecord |
207 | records.where(records.primary_key => ids) | 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 | elsif records.respond_to?(:queryable) | 208 | elsif records.respond_to?(:queryable) |
212 | # Mongoid 3+ | 209 | # Mongoid 3+ |
213 | records.queryable.for_ids(ids) | 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 | # Nobrainer | 212 | # Nobrainer |
216 | records.unscoped.where(:id.in => ids) | 213 | records.unscoped.where(:id.in => ids) |
217 | else | 214 | else |