Skip to content

Instantly share code, notes, and snippets.

@rubysolo
Forked from jimmybaker/gist:308132
Created February 18, 2010 22:16
Show Gist options
  • Save rubysolo/308140 to your computer and use it in GitHub Desktop.
Save rubysolo/308140 to your computer and use it in GitHub Desktop.
def check_for_bid_items
return if user.bids.empty?
@bids_and_items = user.bids.inject({}) do |hsh, bid|
items_for_bid = hsh[bid] || []
items_for_bid += line_items.select{|li| li.product.bids.include?(bid) }
hsh.update(bid => items_for_bid) unless items_for_bid.empty?
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment