#---
# Excerpted from "Rails Recipes"
# We make no guarantees that this code is fit for any purpose. 
# Visit http://www.pragmaticprogrammer.com/titles/fr_rr for more book information.
#---
class ProductReference < ActiveRecord::Base
  belongs_to :product
  has_and_belongs_to_many :carts, 
                          :join_table => "carts_products",
                          :foreign_key => "product_id"
  def name
    product.name
  end
  def price
    product.price
  end
end
