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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d0d9e3d63dbd18d8baab8017ad304e44f55b73ebe42060e0723438b252dc4cfe
4
- data.tar.gz: 1c6cbb926a39f8c2cabe19a44d918e063df2f6278d443ea3d13ffae37b28e608
3
+ metadata.gz: ffaa40afe11c877610e9ca9ba1072e47521c6b188522cf5bba065767129f9ced
4
+ data.tar.gz: 06403fdc5c4303fc80105c5381771db103058bf0f762bd92fc0826c6afa46431
5
5
  SHA512:
6
- metadata.gz: bfafa9a17b95d329a28b0b7b3cc2c570b5cb206b9e9ab51a653f263b971fa59e5d56b4ecc87db02c1a0a526e98ff2ef3012ccc49b31b73da3f7c65cec9d7fc5b
7
- data.tar.gz: 1311efa1ca1b808d636739c417ceb5561976e9d6565096ba871a51bed9e2faa40110de75a000c48d93e51e63e3022f523cdfd7fb05e956e9a82e734c81c704fa
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 { |r| r.send(:write_attribute_without_type_cast, cache_column, timestamp) }
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 = false, &block)
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
@@ -44,7 +44,7 @@ module CachedAt
44
44
  end
45
45
 
46
46
  def update_relations_cached_at(timestamp: nil, method: nil)
47
- method = instance_variable_defined?(:@new_record_before_save) && @new_record_before_save ? :create : :update if method.nil?
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?
@@ -1,3 +1,3 @@
1
1
  module CachedAt
2
- VERSION = '6.0.0'
2
+ VERSION = '6.1.0.rc1'
3
3
  end
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.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-07-19 00:00:00.000000000 Z
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: 5.2.1
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: 5.2.1
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: '0'
171
+ version: 1.3.1
172
172
  requirements: []
173
- rubygems_version: 3.1.2
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`