1
0
Fork 0
forked from OpenNeo/impress

prevent bad behavior when no unworn items

This commit is contained in:
Emi Matchu 2010-11-14 22:31:41 -05:00
parent 36d7cbd997
commit f99c7527d0

View file

@ -51,11 +51,13 @@ class Outfit < ActiveRecord::Base
new_rels = [] new_rels = []
all_item_ids.each do |key, item_ids| all_item_ids.each do |key, item_ids|
worn = key == 'worn' worn = key == 'worn'
item_ids.each do |item_id| unless item_ids.blank?
rel = ItemOutfitRelationship.new item_ids.each do |item_id|
rel.item_id = item_id rel = ItemOutfitRelationship.new
rel.is_worn = worn rel.item_id = item_id
new_rels << rel rel.is_worn = worn
new_rels << rel
end
end end
end end
self.item_outfit_relationships = new_rels self.item_outfit_relationships = new_rels