Sha256: febd3711ed507574fcb93bac94f38525d38b03c472488de4313196dfcbe0ec9d
Contents?: true
Size: 910 Bytes
Versions: 3
Compression:
Stored size: 910 Bytes
Contents
module ActiveRecord module Acts module ShoppingCartItem def self.included(base) base.extend(ClassMethods) end module ClassMethods # # Prepares the class to act as a cart item. # # Receives as a parameter the name of the class that acts as a cart # # Example: # # acts_as_shopping_cart_item :cart # # def acts_as_shopping_cart_item_for(cart_class) self.send :include, ActiveRecord::Acts::ShoppingCartItem::InstanceMethods belongs_to :owner, :polymorphic => true belongs_to :item, :polymorphic => true end # # Alias for: # # acts_as_shopping_cart_item_for :shopping_cart # def acts_as_shopping_cart_item acts_as_shopping_cart_item_for :shopping_cart end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems