database_consistency 0.6.4 → 0.6.5
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6474192e36ae6bcd25dc149e1294ff9c791d2716e2dab3d94191b8c47dd81aef
|
4
|
+
data.tar.gz: d523c7bf119274212cb9da1ead5c04814e970157529e06f03c27b2d7ad2463da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e90c491f1f0ced39b6ce7b66079586f6f42b0405214392f110ec04d6ee41fbcdd01031ac88fc3dfe662669ae3640957941013981c5965a97b6032d36271f105
|
7
|
+
data.tar.gz: f405932ab3023150e3353b5bfe08e6bb56c79b3af0d55a45c2f449c9dee45d1d44ac255e83fecac8b70d8ff967a1b8fe9fe23016446c53b84a27a12bcb666024
|
@@ -21,5 +21,16 @@ module DatabaseConsistency
|
|
21
21
|
def check_inclusion?(array, element)
|
22
22
|
array.include?(element.to_s) || array.include?(element.to_sym)
|
23
23
|
end
|
24
|
+
|
25
|
+
def first_level_associations(model)
|
26
|
+
associations = model.reflect_on_all_associations
|
27
|
+
|
28
|
+
while model != ActiveRecord::Base && model.respond_to?(:reflect_on_all_associations)
|
29
|
+
model = model.superclass
|
30
|
+
associations -= model.reflect_on_all_associations
|
31
|
+
end
|
32
|
+
|
33
|
+
associations
|
34
|
+
end
|
24
35
|
end
|
25
36
|
end
|
@@ -12,7 +12,7 @@ module DatabaseConsistency
|
|
12
12
|
|
13
13
|
def check
|
14
14
|
Helper.models.flat_map do |model|
|
15
|
-
model.
|
15
|
+
Helper.first_level_associations(model).flat_map do |association|
|
16
16
|
enabled_checkers.map do |checker_class|
|
17
17
|
checker = checker_class.new(model, association)
|
18
18
|
checker.report_if_enabled?(configuration)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: database_consistency
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Evgeniy Demin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-01-
|
11
|
+
date: 2019-01-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|