forked from OpenNeo/impress
Fix select bug in Item.all_by_ids_or_children
Idk why, but when the `select` was the first thing in the query, it was getting ignored. I wonder if there's something about the `object_assets` scope that I'm not understanding that's overwriting it? Or the `joins`? But whatever, this works, I'm not worried about it for now!
This commit is contained in:
parent
b8c748aa97
commit
724ed83833
1 changed files with 3 additions and 3 deletions
|
@ -436,11 +436,11 @@ class Item < ActiveRecord::Base
|
||||||
swf_assets_by_id[id] = swf_asset
|
swf_assets_by_id[id] = swf_asset
|
||||||
swf_asset_ids << id
|
swf_asset_ids << id
|
||||||
end
|
end
|
||||||
SwfAsset.select([
|
SwfAsset.object_assets.joins(:parent_swf_asset_relationships).
|
||||||
|
where(SwfAsset.arel_table[:id].in(swf_asset_ids)).select([
|
||||||
SwfAsset.arel_table[:id],
|
SwfAsset.arel_table[:id],
|
||||||
ParentSwfAssetRelationship.arel_table[:parent_id]
|
ParentSwfAssetRelationship.arel_table[:parent_id]
|
||||||
]).object_assets.joins(:parent_swf_asset_relationships).
|
]).each do |row|
|
||||||
where(SwfAsset.arel_table[:id].in(swf_asset_ids)).each do |row|
|
|
||||||
item_id = row.parent_id.to_i
|
item_id = row.parent_id.to_i
|
||||||
swf_assets_by_parent_id[item_id] ||= []
|
swf_assets_by_parent_id[item_id] ||= []
|
||||||
swf_assets_by_parent_id[item_id] << swf_assets_by_id[row.id.to_i]
|
swf_assets_by_parent_id[item_id] << swf_assets_by_id[row.id.to_i]
|
||||||
|
|
Loading…
Reference in a new issue