Sha256: 0941c37562cb0ddb020bac8f191d9e6524eaaf7e27671fc01c5bf3bb413aecf7

Contents?: true

Size: 351 Bytes

Versions: 1

Compression:

Stored size: 351 Bytes

Contents

class Price
  include Mongoid::Document
  embedded_in :pricable, polymorphic: true

  field :_id, type: String, default: nil
  field :currency, type: String
  field :amount, type: Float

  def to_s(missing_string)
    return "#{currency} #{(amount - amount.floor) >0 ? amount : amount.floor}" if currency && amount
    return missing_string
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
models-0.0.22.1 app/models/price.rb