method

collection_by_cache_keys

Importance_0
v7.1.3.4 - Show latest stable - 0 notes - Class: CollectionCaching
collection_by_cache_keys(view, template, collection) private

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# 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
Register or log in to add new notes.