method
collection_by_cache_keys
v8.1.1 -
Show latest stable
- Class:
ActionView::CollectionCaching
collection_by_cache_keys(view, template, collection)private
No documentation available.
# File actionview/lib/action_view/renderer/partial_renderer/collection_caching.rb, line 58
def collection_by_cache_keys(view, template, collection)
seed = callable_cache_key? ? @options[:cached] : ->(i) { i }
digest_path = view.digest_path_from_template(template)
collection.preload! if callable_cache_key?
collection.each_with_object([{}, []]) do |item, (hash, ordered_keys)|
key = expanded_cache_key(seed.call(item), view, template, digest_path)
ordered_keys << key
hash[key] = item
end
end