Simplify Serializer#cached_attributes to take a fields argument

This commit is contained in:
Benjamin Fleischer
2016-04-14 22:53:06 -05:00
parent ba23de686d
commit 385abb4ba0
2 changed files with 4 additions and 4 deletions

View File

@@ -208,17 +208,17 @@ module ActiveModel
end
end
def cached_attributes(options, cached_attributes, adapter_instance)
def cached_attributes(fields, cached_attributes, adapter_instance)
if self.class.cache_enabled?
key = cache_key(adapter_instance)
cached_attributes.fetch(key) do
cache_check(adapter_instance) do
attributes(options[:fields])
attributes(fields)
end
end
else
cache_check(adapter_instance) do
attributes(options[:fields])
attributes(fields)
end
end
end