Class: MageRecord::InvoiceItem

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

Overview

invoice items can be parents / children of other invoice 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



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

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)


29
30
31
# File 'lib/magerecord/invoice_item.rb', line 29

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