database_consistency 0.8.5 → 0.8.6
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: e4c8440238a874ddd2ae11563b8b034c64f94e467426ef85afcd8befdf9a55c2
|
4
|
+
data.tar.gz: 7e7275bf7029cf03a0a9d3e35975d1a927a7317d323c2c7db00eb22306f67aca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dcd5d6ee89a07990da47ad72231aa5884ee8209f071f21a4ab9ae3521f5ae2bd85167b2b31d32052bff081cd240f5965b4eef3f814ab8ce1ee83ab480d9ccaff
|
7
|
+
data.tar.gz: 2ff692d1618d7ef53500ccf3f88bb361c856d62ea7f577ce66a1c18122af0f05c1c55d5023b3313c4a17f55dbd20d14a0193d6116575e1b551651ad5549829ff
|
@@ -17,8 +17,12 @@ module DatabaseConsistency
|
|
17
17
|
|
18
18
|
private
|
19
19
|
|
20
|
+
# We skip check when:
|
21
|
+
# - association is polymorphic association
|
22
|
+
# - association has `through` option
|
23
|
+
# - associated class doesn't exist
|
20
24
|
def preconditions
|
21
|
-
!association.polymorphic? && association.klass.present?
|
25
|
+
!association.polymorphic? && association.through_reflection.nil? && association.klass.present?
|
22
26
|
rescue NameError
|
23
27
|
false
|
24
28
|
end
|
@@ -75,7 +79,7 @@ module DatabaseConsistency
|
|
75
79
|
#
|
76
80
|
# @return [ActiveRecord::ConnectionAdapters::Column]
|
77
81
|
def column(model, column_name)
|
78
|
-
model.connection.columns(model.table_name).find { |column| column.name == column_name }
|
82
|
+
model.connection.columns(model.table_name).find { |column| column.name == column_name.to_s }
|
79
83
|
end
|
80
84
|
|
81
85
|
# @param [ActiveRecord::ConnectionAdapters::Column] column
|
@@ -92,11 +96,6 @@ module DatabaseConsistency
|
|
92
96
|
database_factory.type(type(column)).convert
|
93
97
|
end
|
94
98
|
|
95
|
-
# @return [Boolean]
|
96
|
-
def supported_type?(column)
|
97
|
-
database_factory.type(type(column)).supported?
|
98
|
-
end
|
99
|
-
|
100
99
|
# @return [Boolean]
|
101
100
|
def belongs_to_association?
|
102
101
|
association.macro == :belongs_to
|
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.8.
|
4
|
+
version: 0.8.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Evgeniy Demin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-09-
|
11
|
+
date: 2020-09-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|