Hi Bob. The find method returns a new collection including all
elements for which the block returns boolean true. In this case, your
product and red comparisons happen but are not returned from the block
and are ignored. Whaty ou want is ONE boolean expression combining
all of these comparisons:
@items.find{|item|
item.product == product && item.red == red && item.blue == blue
}
Chad
···
On Mon, Dec 1, 2008 at 6:34 AM, Bob Sanders <small.business.strategy@gmail.com> wrote:
I know that to find an item that satisfies one condition, it's this:
@items.find {|item| item.product == product }
I thought I could try this to check that an item satisfies multiple
conditions:
@items.find {|item|
item.product == product
item.red == red
item.blue == blue
}