Class: MageRecord::OrderItem

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/magerecord/order_item.rb

Overview

order items can be parents / children of other order items (only within the same order)

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, *args, &block) ⇒ Object

call associated product’s method



19
20
21
22
23
24
25
26
27
# File 'lib/magerecord/order_item.rb', line 19

def method_missing(meth, *args, &block)
  if product && product.respond_to?(meth)
    product.send(meth)
  else
    # call superclass's method_missing method
    # or risk breaking Ruby's method lookup
    super
  end
end

Instance Method Details

#respond_to?(meth, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/magerecord/order_item.rb', line 30

def respond_to?(meth, include_private = false)
  super || (product && product.respond_to?(meth))
end