mongoid_includes 3.0.1 → 3.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1fe48fd0ac7d46fb5fe158bac336bfff3a8dde974f10629e3f632fcb3e475e18
4
- data.tar.gz: db7fb5e32b06be95c8e133d48e8882249d623528a4bba05220f762b9a436adc2
3
+ metadata.gz: a8d1edc191e71925a3462bf7016a3df71eca0d73c3257e805b1484b58ea5ecd9
4
+ data.tar.gz: 89b4566f274c31a0df1d61b34cc5f3c04dc8bc51718a6528987df2f3d5eb122c
5
5
  SHA512:
6
- metadata.gz: 0b2e350afb5abc0488ce860052522147cf97f15bd2bbbbda207094e00b2ec0807f281bd44af5f4991eca80139d7d23946a749bf40b3ded0e6ce5d40e870e8243
7
- data.tar.gz: e8bd1062e78e5ed04c1a3c9d1377c218f40c06c4d7f85a917c5df90a588516168ac670c01b8f8f86fc8c7addc89bf84c4443248a3f0c3ba0af719a799ed64936
6
+ metadata.gz: f2adc7ec100121a377091f850489cd60e0de8a6f5a0c55f506482fc0241c2a679297bd6c20dd017ce1b223c186d3067008ef2d4673bc827ba4e82e9f17e867fc
7
+ data.tar.gz: c8c5b23eef7064c2f7e9f8af75806c3507e385684202140653d21dc6bb1f8f57ee628bf9b4f013b3d647bc5558eaffa14931d1edd73efd249aacded0ed518ef1
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## Mongoid::Includes 3.0.2 (2022-11-03) ##
2
+
3
+ * [perf: avoid queries when foreign keys are empty](https://github.com/ElMassimo/mongoid_includes/commit/9f4c0c8bf1560a319c663fae77015c638caec56b)
4
+
5
+ ## Mongoid::Includes 3.0.1 (2022-11-03) ##
6
+
7
+ * Allow installing this library with Mongoid `8.0`.
8
+
1
9
  ## Mongoid::Includes 3.0.0 (2020-10-29) ##
2
10
 
3
11
  * Add support for Mongoid `7.1`.
@@ -9,7 +9,11 @@ module Mongoid
9
9
  # Internal: Performs eager load and iterates over the preloaded documents
10
10
  # for the current relation.
11
11
  def each_loaded_document
12
- @association.load_documents_for(key, keys_from_docs).each do |doc|
12
+ foreign_key_values = keys_from_docs
13
+
14
+ return @association.klass.none if foreign_key_values.empty?
15
+
16
+ @association.load_documents_for(key, foreign_key_values).each do |doc|
13
17
  yield doc
14
18
  end
15
19
  end
@@ -5,6 +5,6 @@ module Mongoid
5
5
  module Includes
6
6
 
7
7
  # Public: This library will attempt to follow semantic versioning (whatever that's supposed to be).
8
- VERSION = '3.0.1'
8
+ VERSION = '3.0.2'
9
9
  end
10
10
  end