Merge branch 'quake-collection_cache' into 0-10-stable

This commit is contained in:
Benjamin Fleischer 2017-11-19 11:50:41 -06:00
commit d274295ee5
2 changed files with 6 additions and 7 deletions

View File

@ -19,11 +19,10 @@ module ActiveModel
# @api private # @api private
def serializable_hash(adapter_options, options, adapter_instance) def serializable_hash(adapter_options, options, adapter_instance)
include_directive = ActiveModel::Serializer.include_directive_from_options(adapter_options) options[:include_directive] ||= ActiveModel::Serializer.include_directive_from_options(adapter_options)
adapter_options[:cached_attributes] ||= ActiveModel::Serializer.cache_read_multi(self, adapter_instance, include_directive) options[:cached_attributes] ||= ActiveModel::Serializer.cache_read_multi(self, adapter_instance, options[:include_directive])
adapter_opts = adapter_options.merge(include_directive: include_directive)
serializers.map do |serializer| serializers.map do |serializer|
serializer.serializable_hash(adapter_opts, options, adapter_instance) serializer.serializable_hash(adapter_options, options, adapter_instance)
end end
end end

View File

@ -415,7 +415,7 @@ module ActiveModelSerializers
adapter_options = {} adapter_options = {}
adapter_instance = ActiveModelSerializers::Adapter::Attributes.new(serializers, adapter_options) adapter_instance = ActiveModelSerializers::Adapter::Attributes.new(serializers, adapter_options)
serializers.serializable_hash(adapter_options, options, adapter_instance) serializers.serializable_hash(adapter_options, options, adapter_instance)
cached_attributes = adapter_options.fetch(:cached_attributes).with_indifferent_access cached_attributes = options.fetch(:cached_attributes).with_indifferent_access
include_directive = ActiveModelSerializers.default_include_directive include_directive = ActiveModelSerializers.default_include_directive
manual_cached_attributes = ActiveModel::Serializer.cache_read_multi(serializers, adapter_instance, include_directive).with_indifferent_access manual_cached_attributes = ActiveModel::Serializer.cache_read_multi(serializers, adapter_instance, include_directive).with_indifferent_access
@ -446,9 +446,9 @@ module ActiveModelSerializers
serializers.serializable_hash(adapter_options, options, adapter_instance) serializers.serializable_hash(adapter_options, options, adapter_instance)
# Should find something with read_multi now # Should find something with read_multi now
adapter_options = {} options = {}
serializers.serializable_hash(adapter_options, options, adapter_instance) serializers.serializable_hash(adapter_options, options, adapter_instance)
cached_attributes = adapter_options.fetch(:cached_attributes) cached_attributes = options.fetch(:cached_attributes)
include_directive = ActiveModelSerializers.default_include_directive include_directive = ActiveModelSerializers.default_include_directive
manual_cached_attributes = ActiveModel::Serializer.cache_read_multi(serializers, adapter_instance, include_directive) manual_cached_attributes = ActiveModel::Serializer.cache_read_multi(serializers, adapter_instance, include_directive)