Sha256: fb681e7d92912fe8c2a9be4a4d929d9642901a4d2f700fee472325b5b669bee3
Contents?: true
Size: 650 Bytes
Versions: 3
Compression:
Stored size: 650 Bytes
Contents
module ActiveRecord module Acts module ShoppingCartItem module InstanceMethods # # Returns the subtotal, multiplying the quantity times the price of the item. # def subtotal self.quantity * self.price end # # Updates the quantity of the item # def update_quantity(new_quantity) self.quantity = new_quantity self.save end # # Updates the price of the item # def update_price(new_price) self.price = new_price self.save end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems