prevent bad behavior when no unworn items
This commit is contained in:
parent
36d7cbd997
commit
f99c7527d0
1 changed files with 7 additions and 5 deletions
|
@ -51,6 +51,7 @@ 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'
|
||||||
|
unless item_ids.blank?
|
||||||
item_ids.each do |item_id|
|
item_ids.each do |item_id|
|
||||||
rel = ItemOutfitRelationship.new
|
rel = ItemOutfitRelationship.new
|
||||||
rel.item_id = item_id
|
rel.item_id = item_id
|
||||||
|
@ -58,6 +59,7 @@ class Outfit < ActiveRecord::Base
|
||||||
new_rels << rel
|
new_rels << rel
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
self.item_outfit_relationships = new_rels
|
self.item_outfit_relationships = new_rels
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue