Sha256: ea67b1c2864b9433a057e6198a2150261a84f83b8cea3cfb2cf7e2b38ab3bc35
Contents?: true
Size: 810 Bytes
Versions: 1
Compression:
Stored size: 810 Bytes
Contents
module MageRecord # order items can be parents / children of other order items # (only within the same order) class OrderItem < ActiveRecord::Base self.table_name = :sales_flat_order_item belongs_to :order belongs_to :parent, class_name: :OrderItem, foreign_key: :parent_item_id belongs_to :product # note: add an index on the column "parent_item_id" to # *dramatically* speed up loading of child order items from the parent order item has_many :children, class_name: :OrderItem, foreign_key: :parent_item_id # call associated product's method def method_missing(meth, *args, &block) super || (product && product.send(meth)) end def respond_to?(meth, include_private = false) super || (product && product.respond_to?(meth)) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
magerecord-0.1.3 | lib/magerecord/order_item.rb |