kasket 4.4.2 → 4.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/kasket/version.rb +1 -1
- data/lib/kasket/write_mixin.rb +21 -9
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba85f36144f05d60bbebcba8a11ff48b930d29cf
|
4
|
+
data.tar.gz: a0ac4b0539ecf1c19f700ec08318a17ea5f01c6f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a25702c95434941d087060eb6c6cab9dd3843701efe293709cdd69de9c6a0ef2d11c9f194a69e9d4c4f703f3e3e1f2ede9970bb58cee42baa8db4b39aee43458
|
7
|
+
data.tar.gz: c68f3966ba94bc372ce16d7e2fd8996ed009ff362f49355181cdf471764b387d373cf540dda854531bd568de2115978b37f54b75a3252ba73b74dce2af46b606
|
data/lib/kasket/version.rb
CHANGED
data/lib/kasket/write_mixin.rb
CHANGED
@@ -37,11 +37,12 @@ module Kasket
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
-
def kasket_keys
|
40
|
+
def kasket_keys(options = {})
|
41
41
|
attribute_sets = [attributes.symbolize_keys]
|
42
42
|
|
43
|
+
previous_changes = options[:previous_changes] || previous_changes()
|
43
44
|
if previous_changes.present?
|
44
|
-
old_attributes = Hash[*previous_changes.map {|attribute, values| [attribute, values[0]]}.flatten].symbolize_keys
|
45
|
+
old_attributes = Hash[*previous_changes.map { |attribute, values| [attribute, values[0]] }.flatten].symbolize_keys
|
45
46
|
attribute_sets << old_attributes.reverse_merge(attribute_sets[0])
|
46
47
|
end
|
47
48
|
|
@@ -71,21 +72,32 @@ module Kasket
|
|
71
72
|
end
|
72
73
|
end
|
73
74
|
|
74
|
-
def clear_kasket_indices
|
75
|
-
kasket_keys.each do |key|
|
75
|
+
def clear_kasket_indices(options = {})
|
76
|
+
kasket_keys(options).each do |key|
|
76
77
|
Kasket.cache.delete(key)
|
77
78
|
end
|
78
79
|
end
|
79
80
|
|
80
|
-
def reload(*
|
81
|
+
def reload(*)
|
81
82
|
clear_kasket_indices
|
82
83
|
super
|
83
84
|
end
|
84
85
|
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
86
|
+
if ActiveRecord::VERSION::MAJOR == 3
|
87
|
+
def update_column(column, value)
|
88
|
+
previous_changes = {column => [attributes[column.to_s], value]}
|
89
|
+
result = super
|
90
|
+
clear_kasket_indices(previous_changes: previous_changes)
|
91
|
+
result
|
92
|
+
end
|
93
|
+
else
|
94
|
+
def update_columns(new_attributes)
|
95
|
+
previous_attributes = attributes
|
96
|
+
previous_changes = new_attributes.each_with_object({}) { |(k, v), all| all[k] = [previous_attributes[k.to_s], v] }
|
97
|
+
result = super
|
98
|
+
clear_kasket_indices(previous_changes: previous_changes)
|
99
|
+
result
|
100
|
+
end
|
89
101
|
end
|
90
102
|
|
91
103
|
def kasket_after_commit_dummy
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kasket
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.4.
|
4
|
+
version: 4.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mick Staugaard
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-08-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|