strict_associations 0.1.8 → 0.1.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 +4 -4
- data/CHANGELOG.md +2 -2
- data/lib/strict_associations/validator.rb +2 -12
- 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: fdbb154fbdfc90017f2c4914e80146bcd5361dc6ee3c8379850bd9a4c0f9e210
|
|
4
|
+
data.tar.gz: cea9f6ec8124170cd6304aedf4687fad98c92e87d15c814c35cb42602a483e98
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 96307c12e6e8438a19e2ecd91d3a5403669b0b9444049c34f0581301da69265b23a006d65d09fbf483a32df313a5569fb42c952107d3ce7e0bf63f43c34765f8
|
|
7
|
+
data.tar.gz: 2025d94dae69ded231d3d2dc0f2fb806773103a06439b1c0a6185d7e5e3f83e215e60c76a00dd2e1dcc2d46f29e9c1f8057ab4528b245358734a68eab686e94e
|
data/CHANGELOG.md
CHANGED
|
@@ -44,22 +44,11 @@ module StrictAssociations
|
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
def view?(model)
|
|
47
|
-
|
|
48
|
-
table = model.table_name
|
|
49
|
-
conn.view_exists?(table) || materialized_view?(conn, table)
|
|
47
|
+
model.connection.view_exists?(model.table_name)
|
|
50
48
|
rescue ActiveRecord::NoDatabaseError
|
|
51
49
|
false
|
|
52
50
|
end
|
|
53
51
|
|
|
54
|
-
def materialized_view?(conn, table_name)
|
|
55
|
-
return false unless conn.adapter_name == "PostgreSQL"
|
|
56
|
-
|
|
57
|
-
conn.select_value(
|
|
58
|
-
"SELECT 1 FROM pg_matviews WHERE matviewname = " \
|
|
59
|
-
"#{conn.quote(table_name)}"
|
|
60
|
-
).present?
|
|
61
|
-
end
|
|
62
|
-
|
|
63
52
|
def check_habtm(model, violations)
|
|
64
53
|
return if config.habtm_allowed?
|
|
65
54
|
|
|
@@ -125,6 +114,7 @@ module StrictAssociations
|
|
|
125
114
|
target = resolve_target(ref)
|
|
126
115
|
next unless target
|
|
127
116
|
next if third_party?(target)
|
|
117
|
+
next if target_is_view?(ref)
|
|
128
118
|
|
|
129
119
|
unless belongs_to_exists?(model, ref, target)
|
|
130
120
|
violations << Violation.new(
|