strict_associations 0.1.2 → 0.1.3
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 +4 -4
- data/CHANGELOG.md +2 -2
- data/lib/strict_associations/validator.rb +7 -1
- data/lib/strict_associations/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a41e36c429c6609f0bf28443610c799cb0d7ece5b2c72f31a3ba3f0dcabc1366
|
|
4
|
+
data.tar.gz: dbc1018a1d8c146aa8c4e2d49558b8731b90d77a56b6dbcf52a204161de6e3af
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5ce5abda2b0ed3dc7e7d397cc53d86f64706bb8b57ec953b51f9900a04262a86d169da1b70a4ee98d428d61a2160ea67f7f4ab4603dcfc2404fae601fb3a4d27
|
|
7
|
+
data.tar.gz: 32d7d39a71358d1ecee58bb6a9d737d94d8fd1c483daf1036981d1d58e742fc8501240a45ec19560eb56ed33fc94e1f847c72bfe83eecb845f5939463b0c34ce
|
data/CHANGELOG.md
CHANGED
|
@@ -271,7 +271,13 @@ module StrictAssociations
|
|
|
271
271
|
next if ref.options[:polymorphic]
|
|
272
272
|
|
|
273
273
|
begin
|
|
274
|
-
|
|
274
|
+
# Use <= instead of == so STI children match a belongs_to pointing to their
|
|
275
|
+
# parent
|
|
276
|
+
# The table_name guard ensures this only applies for true STI (shared
|
|
277
|
+
# table), not unrelated inheritance with different tables.
|
|
278
|
+
source_model <= ref.klass &&
|
|
279
|
+
source_model.table_name == ref.klass.table_name &&
|
|
280
|
+
ref.foreign_key.to_s == fk
|
|
275
281
|
rescue NameError
|
|
276
282
|
false
|
|
277
283
|
end
|