second_level_cache 2.6.3 → 2.6.4

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: 1f5d055fea10f55860339d904a65bb84a51893f742d20758311e0b2c2b690727
4
- data.tar.gz: eeba8b526efb808158e440e10bf752dbf3bc51e5f4d88878f859cf8f3b790647
3
+ metadata.gz: 9401e1e025a3e955471ae743711371608400fe8c7f451f74f8b4f73bbb7c9dd6
4
+ data.tar.gz: 47c05c11d57d26dfe5c990bf111a173d0864956d788c5c5ace70ca812ef3d629
5
5
  SHA512:
6
- metadata.gz: 63ad5288284a4a06735175fb6171962ecde65ad08ffe9cbc112ce060e98c236150acc0b29947536fe06891144929de2ba8e744099a1c31865dccab9c2f9492c9
7
- data.tar.gz: 559d3cde7763d4bd2645a9f416f66bdb54e74e5335004529c88f56bdfc6a3c934a6f7d5ee86aa5377405c12ad09d813ba2cf4313d43704daacd4480e9d25c782
6
+ metadata.gz: 516d74db202dbd5d12f866b36a16b30e763a75fa88001c4ac5ab04ce1c73a2a2e412472ceda957401f9da303094d83c5a944b9c062d69e56116abdae76359256
7
+ data.tar.gz: b0f3440ffd9333d49ac957cc1db3c988f41276d57f18f874fa84fc664134a14ba0acfcc8b9f5001bab99243ef51c2492ca2ea8fe2768ac461b398a1b06504e65
@@ -1,3 +1,13 @@
1
+ 2.6.4
2
+ -------
3
+
4
+ - Fix `undefined method klass` error for has_one through. (#123)
5
+
6
+ 2.6.3
7
+ -------
8
+
9
+ - Fix paranoia load error.
10
+
1
11
  2.6.2
2
12
  -------
3
13
 
data/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
  [![Build Status](https://travis-ci.org/hooopo/second_level_cache.svg?branch=master)](https://travis-ci.org/hooopo/second_level_cache)
5
5
  [![Code Climate](https://codeclimate.com/github/hooopo/second_level_cache.svg)](https://codeclimate.com/github/hooopo/second_level_cache)
6
6
 
7
- SecondLevelCache is a write-through and read-through caching library inspired by Cache Money and cache_fu, support ActiveRecord 4.
7
+ SecondLevelCache is a write-through and read-through caching library inspired by Cache Money and cache_fu, support ActiveRecord 4, ActiveRecord 5 and ActiveRecord 6.
8
8
 
9
9
  Read-Through: Queries by ID, like `current_user.articles.find(params[:id])`, will first look in cache store and then look in the database for the results of that query. If there is a cache miss, it will populate the cache.
10
10
 
@@ -15,10 +15,10 @@ Write-Through: As objects are created, updated, and deleted, all of the caches a
15
15
 
16
16
  In your gem file:
17
17
 
18
- ActiveRecord 5.2:
18
+ ActiveRecord 5.2 and 6.0:
19
19
 
20
20
  ```ruby
21
- gem 'second_level_cache', '~> 2.4.0'
21
+ gem 'second_level_cache', '~> 2.6.3'
22
22
  ```
23
23
 
24
24
  ActiveRecord 5.0.x, 5.1.x:
@@ -11,6 +11,7 @@ module SecondLevelCache
11
11
 
12
12
  through = reflection.options[:through]
13
13
  record = if through
14
+ return super if klass.reflections[through.to_s].nil?
14
15
  return super unless klass.reflections[through.to_s].klass.second_level_cache_enabled?
15
16
  begin
16
17
  reflection.klass.find(owner.send(through).read_attribute(reflection.foreign_key))
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SecondLevelCache
4
- VERSION = "2.6.3"
4
+ VERSION = "2.6.4"
5
5
  end
@@ -30,6 +30,10 @@ class HasOneAssociationTest < ActiveSupport::TestCase
30
30
  ForkedUserLink.without_second_level_cache do
31
31
  assert_queries(1) { user.forked_from_user }
32
32
  end
33
+ # NoMethodError: undefined method `klass' for nil:NilClass active_record/has_one_association.rb:14:in `find_target'
34
+ hotspot = Hotspot.create(summary: "summary")
35
+ assert_equal hotspot.persisted?, true
36
+ assert_nil hotspot.topic
33
37
  end
34
38
 
35
39
  def test_has_one_with_conditions
@@ -6,7 +6,17 @@ ActiveRecord::Base.connection.create_table(:posts, force: true) do |t|
6
6
  t.integer :topic_id
7
7
  end
8
8
 
9
+ ActiveRecord::Base.connection.create_table(:hotspots, force: true) do |t|
10
+ t.integer :post_id
11
+ t.string :summary
12
+ end
13
+
9
14
  class Post < ApplicationRecord
10
15
  second_level_cache
11
16
  belongs_to :topic, touch: true
12
17
  end
18
+
19
+ class Hotspot < ApplicationRecord
20
+ belongs_to :post, required: false
21
+ has_one :topic, through: :post
22
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: second_level_cache
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.3
4
+ version: 2.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hooopo
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-17 00:00:00.000000000 Z
11
+ date: 2020-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -170,7 +170,7 @@ files:
170
170
  homepage: https://github.com/hooopo/second_level_cache
171
171
  licenses: []
172
172
  metadata: {}
173
- post_install_message:
173
+ post_install_message:
174
174
  rdoc_options: []
175
175
  require_paths:
176
176
  - lib
@@ -185,8 +185,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
185
185
  - !ruby/object:Gem::Version
186
186
  version: '0'
187
187
  requirements: []
188
- rubygems_version: 3.0.3
189
- signing_key:
188
+ rubygems_version: 3.1.2
189
+ signing_key:
190
190
  specification_version: 4
191
191
  summary: 'SecondLevelCache is a write-through and read-through caching library inspired
192
192
  by Cache Money and cache_fu, support only Rails3 and ActiveRecord. Read-Through: