Thanks for answering that. Yep, there's a bit here:
https://github.com/n8/multi_fetch_fragments/blob/master/lib/...
@collection.each do |item| key = @options[:cache].is_a?(Proc) ? @options[:cache].call(item) : item expanded_key = ActiveSupport::Cache.expand_cache_key(key) keys_to_collection_map[expanded_key] = item end
Where I use ActiveSupport::Cache.expand_cache_key to create a key based on the item or the Proc passed in. And expand_cache_key does the work of coming up with the proper key. And activerecord objects have a default cache_key implemented that uses an updated_at timestamp if it's available:
http://api.rubyonrails.org/classes/ActiveRecord/Integration....