Sha256: b537dcae97650209105daba1cb775473fc0ca097dcf75e4f18ddc5f0ac25827c
Contents?: true
Size: 910 Bytes
Versions: 10
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
10 entries across 10 versions & 1 rubygems