@@ -2,7 +2,6 @@ module ActiveModel
2
2
class Serializer
3
3
class Adapter
4
4
class FragmentCache
5
-
6
5
attr_reader :serializer
7
6
8
7
def initialize ( adapter , serializer , options )
@@ -35,7 +34,7 @@ def fetch
35
34
36
35
def cached_attributes ( klass , serializers )
37
36
attributes = serializer . class . _attributes
38
- cached_attributes = ( klass . _cache_only ) ? klass . _cache_only : attributes . reject { |attr | klass . _cache_except . include? ( attr ) }
37
+ cached_attributes = ( klass . _cache_only ) ? klass . _cache_only : attributes . reject { |attr | klass . _cache_except . include? ( attr ) }
39
38
non_cached_attributes = attributes - cached_attributes
40
39
41
40
cached_attributes . each do |attribute |
@@ -60,15 +59,15 @@ def fragment_serializer(name, klass)
60
59
Object . const_set cached , Class . new ( ActiveModel ::Serializer ) unless Object . const_defined? ( cached )
61
60
Object . const_set non_cached , Class . new ( ActiveModel ::Serializer ) unless Object . const_defined? ( non_cached )
62
61
63
- klass . _cache_options ||= { }
62
+ klass . _cache_options ||= { }
64
63
klass . _cache_options [ :key ] = klass . _cache_key if klass . _cache_key
65
64
66
65
cached . constantize . cache ( klass . _cache_options )
67
66
68
67
cached . constantize . fragmented ( serializer )
69
68
non_cached . constantize . fragmented ( serializer )
70
69
71
- serializers = { cached : cached , non_cached : non_cached }
70
+ serializers = { cached : cached , non_cached : non_cached }
72
71
cached_attributes ( klass , serializers )
73
72
serializers
74
73
end
0 commit comments