composite_primary_keys 11.0.1 → 11.0.2
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/History.rdoc +8 -1
- data/lib/composite_primary_keys/persistence.rb +0 -60
- data/lib/composite_primary_keys/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fe7dfdfaa1b55a68763587de0f1d7b9fd7c1264fa83a666db64886571dfb890a
|
|
4
|
+
data.tar.gz: 06f9267179912b8b873f096580bfc0a22407878ce94b06dca805ff34f14ecc47
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: dbda63a50cf354490318d0ef5ff082a62b146de042cb8e462b28fac283ce647040f4410960ce0b1fb0c12fee99c43a6ac9d17fc0f4d8771133bb654b61c50ed7
|
|
7
|
+
data.tar.gz: b360de0431222facb297a066519fcab4f9a32ce61d64a3e7d1cb8a0ce9535894b1b1d9c92262e29a10c4ae996f18e5e2a3c2a27af650790ed2995f2bfe02185b
|
data/History.rdoc
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
== 11.0.2 (2018-06-24)
|
|
2
|
+
* Remove no longer needed overrides (Charlie Savage)
|
|
3
|
+
|
|
1
4
|
== 11.0.1 (2018-06-20)
|
|
2
5
|
* Fix in_batches (Urmo Rae)
|
|
3
6
|
* Fix apply_join_dependency (Charlie Savage)
|
|
@@ -34,7 +37,7 @@
|
|
|
34
37
|
|
|
35
38
|
* ActiveRecord 5.2.beta2 support (Charlie Savage)
|
|
36
39
|
|
|
37
|
-
== 10.0.5 (
|
|
40
|
+
== 10.0.5 (2018-06-24)
|
|
38
41
|
* Fix in_batches (Urmo Rae)
|
|
39
42
|
|
|
40
43
|
== 10.0.4 (2018-06-17)
|
|
@@ -64,6 +67,10 @@
|
|
|
64
67
|
* Fix typo in Readme (Mike Gunderloy)
|
|
65
68
|
* Improved sql server support (Artyom Nikolaev)
|
|
66
69
|
|
|
70
|
+
== 9.0.10 (2018-06-24)
|
|
71
|
+
|
|
72
|
+
* Fix AR 5.0.7 (Jordan Owens)
|
|
73
|
+
|
|
67
74
|
== 9.0.8 (2017-10-11)
|
|
68
75
|
|
|
69
76
|
* Fix Paper Trail compatibility (Sean Linsley)
|
|
@@ -56,65 +56,5 @@ module ActiveRecord
|
|
|
56
56
|
connection.delete(dm, "#{self} Destroy")
|
|
57
57
|
end
|
|
58
58
|
end
|
|
59
|
-
|
|
60
|
-
def _relation_for_itself
|
|
61
|
-
# CPK
|
|
62
|
-
if self.composite?
|
|
63
|
-
relation = self.class.unscoped
|
|
64
|
-
|
|
65
|
-
Array(self.class.primary_key).each do |key|
|
|
66
|
-
column = self.class.arel_table[key]
|
|
67
|
-
value = self[key]
|
|
68
|
-
relation = relation.where(column.eq(value))
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
relation
|
|
72
|
-
else
|
|
73
|
-
self.class.unscoped.where(self.class.primary_key => id)
|
|
74
|
-
end
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
def touch(*names, time: nil)
|
|
78
|
-
raise ActiveRecordError, "cannot touch on a new record object" unless persisted?
|
|
79
|
-
|
|
80
|
-
time ||= current_time_from_proper_timezone
|
|
81
|
-
attributes = timestamp_attributes_for_update_in_model
|
|
82
|
-
attributes.concat(names)
|
|
83
|
-
|
|
84
|
-
unless attributes.empty?
|
|
85
|
-
changes = {}
|
|
86
|
-
|
|
87
|
-
attributes.each do |column|
|
|
88
|
-
column = column.to_s
|
|
89
|
-
changes[column] = write_attribute(column, time)
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
clear_attribute_changes(changes.keys)
|
|
93
|
-
primary_key = self.class.primary_key
|
|
94
|
-
scope = self.class.unscoped.where(primary_key => _read_attribute(primary_key))
|
|
95
|
-
|
|
96
|
-
if locking_enabled?
|
|
97
|
-
locking_column = self.class.locking_column
|
|
98
|
-
scope = scope.where(locking_column => _read_attribute(locking_column))
|
|
99
|
-
changes[locking_column] = increment_lock
|
|
100
|
-
end
|
|
101
|
-
|
|
102
|
-
# CPK
|
|
103
|
-
if composite?
|
|
104
|
-
primary_key_predicate = self.class.unscoped.cpk_id_predicate(self.class.arel_table, Array(primary_key), Array(id))
|
|
105
|
-
scope = self.class.unscoped.where(primary_key_predicate)
|
|
106
|
-
end
|
|
107
|
-
|
|
108
|
-
result = scope.update_all(changes) == 1
|
|
109
|
-
|
|
110
|
-
if !result && locking_enabled?
|
|
111
|
-
raise ActiveRecord::StaleObjectError.new(self, "touch")
|
|
112
|
-
end
|
|
113
|
-
|
|
114
|
-
result
|
|
115
|
-
else
|
|
116
|
-
true
|
|
117
|
-
end
|
|
118
|
-
end
|
|
119
59
|
end
|
|
120
60
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: composite_primary_keys
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 11.0.
|
|
4
|
+
version: 11.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Charlie Savage
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2018-06-
|
|
11
|
+
date: 2018-06-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activerecord
|