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: e4c8440238a874ddd2ae11563b8b034c64f94e467426ef85afcd8befdf9a55c2
4
- data.tar.gz: 7e7275bf7029cf03a0a9d3e35975d1a927a7317d323c2c7db00eb22306f67aca
3
+ metadata.gz: b1dff50eb6317680dc36fc0260a90c4071bfada212d1124169437123b93d1f65
4
+ data.tar.gz: 1fcd504bfaed4674386b3af7d53d9d2d2bd2b1f28d2fb65cd3ae1c1c0f1f1eae
5
5
  SHA512:
6
- metadata.gz: dcd5d6ee89a07990da47ad72231aa5884ee8209f071f21a4ab9ae3521f5ae2bd85167b2b31d32052bff081cd240f5965b4eef3f814ab8ce1ee83ab480d9ccaff
7
- data.tar.gz: 2ff692d1618d7ef53500ccf3f88bb361c856d62ea7f577ce66a1c18122af0f05c1c55d5023b3313c4a17f55dbd20d14a0193d6116575e1b551651ad5549829ff
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 ||= belongs_to_association? ? association.foreign_key : association.active_record_primary_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 ||= belongs_to_association? ? association.active_record_primary_key : association.foreign_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.to_s }
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DatabaseConsistency
4
- VERSION = '0.8.6'
4
+ VERSION = '0.8.7'
5
5
  end
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.6
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-22 00:00:00.000000000 Z
11
+ date: 2020-09-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord