check if items are compatible before saving

This commit is contained in:
Emi Matchu 2010-10-09 11:06:59 -04:00
parent 04138ac4a7
commit 3ab730135f

View file

@ -127,7 +127,7 @@ class Item < ActiveRecord::Base
items = {} items = {}
item_ids = [] item_ids = []
info_registry.each do |info| info_registry.each do |info|
if info if info && info[:is_compatible]
item_ids << info[:obj_info_id].to_i item_ids << info[:obj_info_id].to_i
end end
end end
@ -155,6 +155,7 @@ class Item < ActiveRecord::Base
asset_registry.each do |asset_data| asset_registry.each do |asset_data|
if asset_data if asset_data
item_id = asset_data[:obj_info_id].to_i item_id = asset_data[:obj_info_id].to_i
next unless item_ids.include?(item_id) # skip incompatible
item = items[item_id] item = items[item_id]
unless item unless item
item = Item.new item = Item.new