Class: RightnowOms::CartItem

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/rightnow_oms/cart_item.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.find_by_cartable(cartable) ⇒ Object



48
49
50
# File 'app/models/rightnow_oms/cart_item.rb', line 48

def find_by_cartable(cartable)
  find_by_cartable_id_and_cartable_type(cartable.id, cartable.class)
end

.rootsObject



44
45
46
# File 'app/models/rightnow_oms/cart_item.rb', line 44

def roots
  where(parent_id: nil)
end

Instance Method Details

#original_priceObject



39
40
41
# File 'app/models/rightnow_oms/cart_item.rb', line 39

def original_price
  cartable.cartable_price
end

#totalObject



35
36
37
# File 'app/models/rightnow_oms/cart_item.rb', line 35

def total
  price * quantity
end