Skip to content

Instantly share code, notes, and snippets.

@jimmybaker
Created February 18, 2010 22:58
Show Gist options
  • Save jimmybaker/308180 to your computer and use it in GitHub Desktop.
Save jimmybaker/308180 to your computer and use it in GitHub Desktop.
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
# send an email with items from each bid..
SalesOrderMailer.deliver_bid_item_purchase_notification(@bids_and_items, self) unless @bids_and_items.empty?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment