second_level_cache 2.4.0 → 2.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/second_level_cache/active_record.rb +1 -1
- data/lib/second_level_cache/version.rb +1 -1
- data/test/finder_methods_test.rb +8 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 041a857d039324cda299622c23936f20fe9d83f9
|
4
|
+
data.tar.gz: 5a4ce5a3a3c1638eb74f9379d0f8421008c6b834
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9444daff1fdeb5378db6ea2dc3e907744f2035dada6cb9b94bf47b88fa6894639a371438a02b2577ed41459d856c2b065240e322cbc156884abfaf8409c2b3ed
|
7
|
+
data.tar.gz: 1e84301c16f4129f130503e1fcc7096a19cf8213e6937cedfae1724422fc793e6246bed7f66e44fac1a757dcab2a2bb13588280abc8ac2b479ed520d5ab70171
|
@@ -20,7 +20,7 @@ ActiveSupport.on_load(:active_record) do
|
|
20
20
|
|
21
21
|
ActiveRecord::Associations::BelongsToAssociation.send(:prepend, SecondLevelCache::ActiveRecord::Associations::BelongsToAssociation)
|
22
22
|
ActiveRecord::Associations::HasOneAssociation.send(:prepend, SecondLevelCache::ActiveRecord::Associations::HasOneAssociation)
|
23
|
-
|
23
|
+
ActiveRecord::Relation.send(:prepend, SecondLevelCache::ActiveRecord::FinderMethods)
|
24
24
|
# Rails 5.2 has removed ActiveRecord::Associations::Preloader::BelongsTo
|
25
25
|
# https://github.com/rails/rails/pull/31079
|
26
26
|
ActiveRecord::Associations::Preloader::Association.send(:prepend, SecondLevelCache::ActiveRecord::Associations::Preloader::BelongsTo)
|
data/test/finder_methods_test.rb
CHANGED
@@ -5,6 +5,7 @@ require "test_helper"
|
|
5
5
|
class FinderMethodsTest < ActiveSupport::TestCase
|
6
6
|
def setup
|
7
7
|
@user = User.create name: "csdn", email: "test@csdn.com"
|
8
|
+
@book = @user.books.create
|
8
9
|
end
|
9
10
|
|
10
11
|
def test_should_find_without_cache
|
@@ -20,6 +21,13 @@ class FinderMethodsTest < ActiveSupport::TestCase
|
|
20
21
|
end
|
21
22
|
end
|
22
23
|
|
24
|
+
def test_should_find_with_has_many
|
25
|
+
@book.write_second_level_cache
|
26
|
+
assert_no_queries do
|
27
|
+
assert_equal @book, @user.books.find(@book.id)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
23
31
|
def test_should_find_with_cache
|
24
32
|
@user.write_second_level_cache
|
25
33
|
assert_no_queries do
|
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.4.
|
4
|
+
version: 2.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hooopo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-03-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -192,7 +192,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
192
192
|
version: '0'
|
193
193
|
requirements: []
|
194
194
|
rubyforge_project:
|
195
|
-
rubygems_version: 2.
|
195
|
+
rubygems_version: 2.6.11
|
196
196
|
signing_key:
|
197
197
|
specification_version: 4
|
198
198
|
summary: 'SecondLevelCache is a write-through and read-through caching library inspired
|