From e48d00294d6867659d020b89651da9ca33fa86c0 Mon Sep 17 00:00:00 2001 From: Matchu Date: Sun, 28 Jul 2013 23:30:29 -0700 Subject: [PATCH] fix silly closet hanger merge bug involving flex --- app/models/closet_hanger.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/models/closet_hanger.rb b/app/models/closet_hanger.rb index 1f63739f..feb9513a 100644 --- a/app/models/closet_hanger.rb +++ b/app/models/closet_hanger.rb @@ -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