database_consistency 0.8.6 → 0.8.7
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b1dff50eb6317680dc36fc0260a90c4071bfada212d1124169437123b93d1f65
|
4
|
+
data.tar.gz: 1fcd504bfaed4674386b3af7d53d9d2d2bd2b1f28d2fb65cd3ae1c1c0f1f1eae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22aaae1a55a6c7bc6dd3027852cf8e8b0e94e970c06ac445455e1c5abe787be2a273ed9d7f2b7e9c13b5455f827b1bec82d02eb117eed2599c8e90ebd12719ab
|
7
|
+
data.tar.gz: e9203782f9364aa086c1ee20e03d6497c92ce17d5e5ece293390549ce4e4f3dbeb0ff07980a9be5548558d59527c4e2a5d0c3928b67991ca27d99fa5f9908dfb
|
@@ -51,12 +51,24 @@ module DatabaseConsistency
|
|
51
51
|
|
52
52
|
# @return [String]
|
53
53
|
def base_key
|
54
|
-
@base_key ||=
|
54
|
+
@base_key ||= (
|
55
|
+
if belongs_to_association?
|
56
|
+
association.foreign_key
|
57
|
+
else
|
58
|
+
association.active_record_primary_key
|
59
|
+
end
|
60
|
+
).to_s
|
55
61
|
end
|
56
62
|
|
57
63
|
# @return [String]
|
58
64
|
def associated_key
|
59
|
-
@associated_key ||=
|
65
|
+
@associated_key ||= (
|
66
|
+
if belongs_to_association?
|
67
|
+
association.active_record_primary_key
|
68
|
+
else
|
69
|
+
association.foreign_key
|
70
|
+
end
|
71
|
+
).to_s
|
60
72
|
end
|
61
73
|
|
62
74
|
# @return [ActiveRecord::ConnectionAdapters::Column]
|
@@ -79,7 +91,7 @@ module DatabaseConsistency
|
|
79
91
|
#
|
80
92
|
# @return [ActiveRecord::ConnectionAdapters::Column]
|
81
93
|
def column(model, column_name)
|
82
|
-
model.connection.columns(model.table_name).find { |column| column.name == column_name
|
94
|
+
model.connection.columns(model.table_name).find { |column| column.name == column_name }
|
83
95
|
end
|
84
96
|
|
85
97
|
# @param [ActiveRecord::ConnectionAdapters::Column] column
|
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.7
|
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-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|