Skip to content

Instantly share code, notes, and snippets.

@tammersaleh
Created November 11, 2009 17:17
Show Gist options
  • Save tammersaleh/232122 to your computer and use it in GitHub Desktop.
Save tammersaleh/232122 to your computer and use it in GitHub Desktop.
class ShoppingCart < ActiveRecord::Base
has_many :shopping_cart_items
def remove_product(product)
for item in shopping_cart_items do
if item.product == product then
item.destroy
shopping_cart_items.reload
break
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment