crowdint / acts_as_shopping_cart

Simple Shopping Cart implementation, Official repo: https://github.com/dabit/acts_as_shopping_cart
MIT License
257 stars 88 forks source link

Its now working with STI as item_for search for Parent class #44

Open imsinu9 opened 8 years ago

imsinu9 commented 8 years ago
def item_for(object)
  shopping_cart_items.where(:item => object).first
end

This returns parent object and if child object is passed as object it returns nil which makes remove call not to execute.

To work with STI

I have to override this method in my model which act like Shopping Cart.