forked from OpenNeo/impress
cut down on pets#load zone queries
This commit is contained in:
parent
a39110884d
commit
0b32e8ba59
2 changed files with 4 additions and 2 deletions
|
@ -342,7 +342,8 @@ class Item < ActiveRecord::Base
|
|||
asset_registry.each do |asset_id, asset_data|
|
||||
swf_asset_ids << asset_id.to_i if asset_data
|
||||
end
|
||||
existing_swf_assets = SwfAsset.object_assets.find_all_by_remote_id swf_asset_ids
|
||||
existing_swf_assets = SwfAsset.object_assets.includes(:zone).
|
||||
find_all_by_remote_id swf_asset_ids
|
||||
existing_swf_assets_by_remote_id = {}
|
||||
existing_swf_assets.each do |swf_asset|
|
||||
existing_swf_assets_by_remote_id[swf_asset.remote_id] = swf_asset
|
||||
|
|
|
@ -120,7 +120,8 @@ class PetState < ActiveRecord::Base
|
|||
swf_asset_ids_str
|
||||
)
|
||||
end
|
||||
existing_swf_assets = SwfAsset.biology_assets.find_all_by_remote_id(swf_asset_ids)
|
||||
existing_swf_assets = SwfAsset.biology_assets.includes(:zone).
|
||||
find_all_by_remote_id(swf_asset_ids)
|
||||
existing_swf_assets_by_id = {}
|
||||
existing_swf_assets.each do |swf_asset|
|
||||
existing_swf_assets_by_id[swf_asset.remote_id] = swf_asset
|
||||
|
|
Loading…
Reference in a new issue