composite_primary_keys 7.0.8 → 7.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b5c17b61f779d1923c042647a3a0dea63142517
|
4
|
+
data.tar.gz: 3861e029662b85465c42b792fa44ffdfc6671c1e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97c81fea4acb2ba76454d845f3d7bd009739f1d254a920a9f2332d9976e8f15113fa5e4ef8e3f7805b61e3adfcee39ce7c3866c3948251a6955af8727ddef025
|
7
|
+
data.tar.gz: 9e92b5600385939973741abc0bb8b27b580cd0ad5931ef1015d8de7fa2cfa5aae38df75a20b68a798a856064bccb214a5a70b3025c7369ffc0ea376f2ec2e044
|
data/History.rdoc
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
== 7.0.9 (2014-08-03)
|
2
|
+
|
3
|
+
* Second attemp at fixing instantiation of has_many records via :includes that use composite keys - this
|
4
|
+
time take into account no target records (Charlie Savage)
|
5
|
+
|
1
6
|
== 7.0.8 (2014-08-03)
|
2
7
|
|
3
8
|
* Fix instantiation of has_many records via :includes that use composite keys (Charlie Savage)
|
@@ -64,9 +64,10 @@ module ActiveRecord
|
|
64
64
|
# CPK
|
65
65
|
if key.is_a?(Array)
|
66
66
|
id = Array(key).map do |column_alias|
|
67
|
-
row[column_alias]
|
67
|
+
value = row[column_alias]
|
68
68
|
end
|
69
|
-
|
69
|
+
# At least the first value in the key has to be set. Should we require all values to be set?
|
70
|
+
next if id.first.nil?
|
70
71
|
else
|
71
72
|
id = row[key]
|
72
73
|
next if id.nil?
|
data/test/test_associations.rb
CHANGED
@@ -43,20 +43,20 @@ class TestAssociations < ActiveSupport::TestCase
|
|
43
43
|
product = products(:second_product)
|
44
44
|
product_tarrif = product_tariffs(:second_free)
|
45
45
|
|
46
|
-
#
|
47
|
-
|
48
|
-
# :conditions => ["product_tariffs.product_id = ?", product.id])
|
49
|
-
products = Product.includes(:product_tariffs).where("product_tariffs.product_id = ?", product.id).references(:product_tariffs)
|
50
|
-
|
46
|
+
# First get a legitimate product tarrif
|
47
|
+
products = Product.includes(:product_tariffs).where('product_tariffs.product_id = ?', product.id).references(:product_tariffs)
|
51
48
|
assert_equal(1, products.length)
|
52
49
|
assert_equal(product, products.first)
|
53
|
-
assert_equal([product_tarrif],
|
50
|
+
assert_equal([product_tarrif], products.first.product_tariffs)
|
51
|
+
end
|
54
52
|
|
55
|
-
|
56
|
-
|
53
|
+
def test_find_eager_loading_none
|
54
|
+
product = products(:third_product)
|
55
|
+
|
56
|
+
products = Product.includes(:product_tariffs).where(:id => product.id).references(:product_tariffs)
|
57
57
|
assert_equal(1, products.length)
|
58
58
|
assert_equal(product, products.first)
|
59
|
-
|
59
|
+
assert_empty(products.first.product_tariffs)
|
60
60
|
end
|
61
61
|
|
62
62
|
def test_find_includes_tariffs
|