second_level_cache 2.1.13 → 2.1.14
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7686a42b44f437f2e6fc609d96522d1379b7a200
|
4
|
+
data.tar.gz: ba2e25b305dbfdcd28422f7336a4d626799eb248
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 80c5b721865aa021c8e849b2fd9e55fe76f70b1d4bb9d1f15c8f0219e46ce2f55cc87314c1db8c03fcfc9b1606078d9d23362dbba2a54fb7891877536ca4e081
|
7
|
+
data.tar.gz: a324360eb82ba9b00045aca3e85e6e7c6cef69376b91de60cef776c9c5b432467d1f7728c0dcb59965bf37a6048432a2e463b71e830d2867905586d5c7514fdd
|
data/CHANGELOG.md
CHANGED
@@ -12,10 +12,13 @@ module SecondLevelCache
|
|
12
12
|
|
13
13
|
def find_target_with_second_level_cache
|
14
14
|
return find_target_without_second_level_cache unless klass.second_level_cache_enabled?
|
15
|
-
|
16
|
-
|
15
|
+
|
16
|
+
return find_target_without_second_level_cache if reflection.options[:through]
|
17
|
+
# TODO: implement cache with has_one through
|
17
18
|
if reflection.options[:as]
|
18
19
|
cache_record = klass.fetch_by_uniq_keys({reflection.foreign_key => owner[reflection.active_record_primary_key], reflection.type => owner.class.base_class.name})
|
20
|
+
elsif reflection.scope
|
21
|
+
cache_record = klass.fetch_by_uniq_keys(create_scope)
|
19
22
|
else
|
20
23
|
cache_record = klass.fetch_by_uniq_key(owner[reflection.active_record_primary_key], reflection.foreign_key)
|
21
24
|
end
|
@@ -31,7 +31,11 @@ class HasOneAssociationTest < ActiveSupport::TestCase
|
|
31
31
|
user.create_namespace(name: 'hooopo')
|
32
32
|
group_namespace2 = Namespace.create(user_id: user.id, name: 'rails', kind: 'group')
|
33
33
|
assert_not_equal user.namespace, nil
|
34
|
-
|
34
|
+
assert_equal user.reload.namespace.name, 'hooopo'
|
35
|
+
clear_user = user.reload
|
36
|
+
assert_no_queries do
|
37
|
+
clear_user.namespace
|
38
|
+
end
|
35
39
|
assert_equal clear_user.namespace.name, 'hooopo'
|
36
40
|
end
|
37
41
|
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.1.
|
4
|
+
version: 2.1.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hooopo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-10-
|
11
|
+
date: 2016-10-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|