Module: ActsAsPurchasable::ActiveRecord

Defined in:
app/models/concerns/acts_as_purchasable.rb

Instance Method Summary collapse

Instance Method Details

#acts_as_purchasable(*options) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/models/concerns/acts_as_purchasable.rb', line 5

def acts_as_purchasable(*options)
  @acts_as_purchasable = options || []

  if table_exists?
    instance = new()
    raise 'must respond_to price' unless instance.respond_to?(:price)
    raise 'must respond_to purchased_order_id' unless instance.respond_to?(:purchased_order_id)

    if defined?(EffectiveQbSync)
      raise 'must respond to qb_item_name' unless instance.respond_to?(:qb_item_name)
    end
  end

  include ::ActsAsPurchasable
end