activerecord-cached_at 6.0.0 → 6.1.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cached_at/associations/collection_association.rb +5 -3
- data/lib/cached_at/base.rb +1 -1
- data/lib/cached_at/version.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ffaa40afe11c877610e9ca9ba1072e47521c6b188522cf5bba065767129f9ced
|
4
|
+
data.tar.gz: 06403fdc5c4303fc80105c5381771db103058bf0f762bd92fc0826c6afa46431
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 328f5606ca71e467cfab60b136bfe7429010f2adff5227c495916089feb03d6a98be86740fe488d833a510e7239467f192d91530d749b5fb9f67eb6a52e90e2d
|
7
|
+
data.tar.gz: ca67eddf6423cb2930860dfd00943a7ea649fd5104b03c94c0b894f087d469ad0ef88f7e7b18cccadbf6c7410d07d92074f1bf137a6bd28dba58b1692ec6e7cf
|
@@ -12,9 +12,11 @@ module CachedAt
|
|
12
12
|
cache_column = "#{reflection.inverse_of.name}_cached_at"
|
13
13
|
ids = [owner.send(reflection.association_primary_key), owner.send("#{reflection.association_primary_key}_before_last_save")].compact.uniq
|
14
14
|
query = klass.where({ reflection.foreign_key => ids })
|
15
|
-
|
15
|
+
|
16
16
|
if loaded?
|
17
|
-
target.each
|
17
|
+
target.each do |record|
|
18
|
+
record.send(:write_attribute_without_type_cast, cache_column, timestamp)
|
19
|
+
end
|
18
20
|
end
|
19
21
|
|
20
22
|
if method != :destroy
|
@@ -47,7 +49,7 @@ module CachedAt
|
|
47
49
|
traverse_relationships(klass, options[:cached_at], query, cache_column, timestamp)
|
48
50
|
end
|
49
51
|
|
50
|
-
def add_to_target(record, skip_callbacks
|
52
|
+
def add_to_target(record, skip_callbacks: false, replace: false, &block)
|
51
53
|
value = super
|
52
54
|
touch_records_cached_at([record], Time.now) if !(instance_variable_defined?(:@caching) && @caching)
|
53
55
|
value
|
data/lib/cached_at/base.rb
CHANGED
@@ -44,7 +44,7 @@ module CachedAt
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def update_relations_cached_at(timestamp: nil, method: nil)
|
47
|
-
method =
|
47
|
+
method = @_new_record_before_last_commit ? :create : :update if method.nil?
|
48
48
|
|
49
49
|
diff = saved_changes.transform_values(&:first)
|
50
50
|
return if method == :create && diff.empty?
|
data/lib/cached_at/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-cached_at
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.0.
|
4
|
+
version: 6.1.0.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jon Bracy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 6.1.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 6.1.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -166,11 +166,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
166
166
|
version: '0'
|
167
167
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
168
168
|
requirements:
|
169
|
-
- - "
|
169
|
+
- - ">"
|
170
170
|
- !ruby/object:Gem::Version
|
171
|
-
version:
|
171
|
+
version: 1.3.1
|
172
172
|
requirements: []
|
173
|
-
rubygems_version: 3.1.
|
173
|
+
rubygems_version: 3.1.4
|
174
174
|
signing_key:
|
175
175
|
specification_version: 4
|
176
176
|
summary: Allows ActiveRecord and Rails to use a `cached_at` column for the `cache_key`
|