ensure that we're looking only at biology assets when saving new pet states

This commit is contained in:
Emi Matchu 2010-11-20 10:35:59 -05:00
parent 668411fa4f
commit 63ae4558b1
3 changed files with 4 additions and 4 deletions

View file

@ -217,8 +217,7 @@ class Item < ActiveRecord::Base
asset_registry.each_with_index do |asset_data, index| asset_registry.each_with_index do |asset_data, index|
swf_asset_ids << index if asset_data swf_asset_ids << index if asset_data
end end
existing_swf_assets = SwfAsset.find_all_by_id swf_asset_ids, existing_swf_assets = SwfAsset.object_assets.find_all_by_id swf_asset_ids
:conditions => {:type => SwfAssetType}
existing_swf_assets_by_id = {} existing_swf_assets_by_id = {}
existing_swf_assets.each do |swf_asset| existing_swf_assets.each do |swf_asset|
existing_swf_assets_by_id[swf_asset.id] = swf_asset existing_swf_assets_by_id[swf_asset.id] = swf_asset

View file

@ -63,7 +63,7 @@ class PetState < ActiveRecord::Base
swf_asset_ids_str swf_asset_ids_str
) )
end end
existing_swf_assets = SwfAsset.find_all_by_id(swf_asset_ids) existing_swf_assets = SwfAsset.biology_assets.find_all_by_id(swf_asset_ids)
existing_swf_assets_by_id = {} existing_swf_assets_by_id = {}
existing_swf_assets.each do |swf_asset| existing_swf_assets.each do |swf_asset|
existing_swf_assets_by_id[swf_asset.id] = swf_asset existing_swf_assets_by_id[swf_asset.id] = swf_asset

View file

@ -20,7 +20,8 @@ class SwfAsset < ActiveRecord::Base
where(arel_table[:body_id].in(BodyIdsFittingStandard)) where(arel_table[:body_id].in(BodyIdsFittingStandard))
} }
scope :object_assets, where(arel_table[:type].eq('object')) scope :biology_assets, where(arel_table[:type].eq(PetState::SwfAssetType))
scope :object_assets, where(arel_table[:type].eq(Item::SwfAssetType))
def local_url def local_url
'/' + File.join(PUBLIC_ASSET_DIR, local_path_within_outfit_swfs) '/' + File.join(PUBLIC_ASSET_DIR, local_path_within_outfit_swfs)