fix silly closet hanger merge bug involving flex

This commit is contained in:
Emi Matchu 2013-07-28 23:30:29 -07:00
parent 082119afe1
commit e48d00294d

View file

@ -116,8 +116,9 @@ class ClosetHanger < ActiveRecord::Base
def merge_quantities
# Find a hanger that conflicts: for the same item, in the same user's
# closet, same owned status, same list. It also must not be the current
# hanger.
conflicting_hanger = self.class.select([:id, :quantity]).
# hanger. Select enough for our logic and to update flex_source.
conflicting_hanger = self.class.select([:id, :quantity, :user_id, :item_id,
:owned]).
where(:user_id => user_id, :item_id => item_id, :owned => owned,
:list_id => list_id).where(['id != ?', self.id]).first