From 3ab730135f0109401cb34d5b5a8a60e2ac7c7d7e Mon Sep 17 00:00:00 2001 From: Matchu Date: Sat, 9 Oct 2010 11:06:59 -0400 Subject: [PATCH] check if items are compatible before saving --- app/models/item.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/item.rb b/app/models/item.rb index 4ebb4fa4..661ad1f4 100644 --- a/app/models/item.rb +++ b/app/models/item.rb @@ -127,7 +127,7 @@ class Item < ActiveRecord::Base items = {} item_ids = [] info_registry.each do |info| - if info + if info && info[:is_compatible] item_ids << info[:obj_info_id].to_i end end @@ -155,6 +155,7 @@ class Item < ActiveRecord::Base asset_registry.each do |asset_data| if asset_data item_id = asset_data[:obj_info_id].to_i + next unless item_ids.include?(item_id) # skip incompatible item = items[item_id] unless item item = Item.new