Remove intermediary arrays when creating hash maps from results (#9291)
This commit is contained in:
parent
367ad21995
commit
8069fd636b
11 changed files with 20 additions and 20 deletions
|
@ -113,7 +113,7 @@ class ApplicationController < ActionController::Base
|
|||
klass.reload_stale_associations!(cached_keys_with_value.values) if klass.respond_to?(:reload_stale_associations!)
|
||||
|
||||
unless uncached_ids.empty?
|
||||
uncached = klass.where(id: uncached_ids).with_includes.map { |item| [item.id, item] }.to_h
|
||||
uncached = klass.where(id: uncached_ids).with_includes.each_with_object({}) { |item, h| h[item.id] = item }
|
||||
|
||||
uncached.each_value do |item|
|
||||
Rails.cache.write(item, item)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue