Module: Stall::Models::LineItem

Extended by:
ActiveSupport::Concern
Included in:
LineItem
Defined in:
app/models/stall/models/line_item.rb

Instance Method Summary collapse

Instance Method Details

#currencyObject



43
44
45
# File 'app/models/stall/models/line_item.rb', line 43

def currency
  product_list.try(:currency) || Money.default_currency
end

#like?(other) ⇒ Boolean

Returns:

  • (Boolean)


37
38
39
40
41
# File 'app/models/stall/models/line_item.rb', line 37

def like?(other)
  [:sellable_id, :sellable_type].all? do |property|
    public_send(property) == other.public_send(property)
  end
end

#total_weightObject



51
52
53
# File 'app/models/stall/models/line_item.rb', line 51

def total_weight
  weight * quantity
end

#weightObject



47
48
49
# File 'app/models/stall/models/line_item.rb', line 47

def weight
  read_store_attribute(:data, :weight).presence || Stall.config.default_product_weight
end