Sha256: e1f1dc7af79ecb32ad3e073706f831df0965eca405aaf437bbe58dff7f1f94bb

Contents?: true

Size: 247 Bytes

Versions: 13

Compression:

Stored size: 247 Bytes

Contents

module MechanizeStore
  class OrderItem < ActiveRecord::Base
    belongs_to :order
    belongs_to :product

    validates :quantity, :price, :product_id, presence: true

    def total
        self.quantity.to_f * self.price.to_f
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
mechanize_store-0.0.19 app/models/mechanize_store/order_item.rb
mechanize_store-0.0.18 app/models/mechanize_store/order_item.rb
mechanize_store-0.0.17 app/models/mechanize_store/order_item.rb
mechanize_store-0.0.16 app/models/mechanize_store/order_item.rb
mechanize_store-0.0.15 app/models/mechanize_store/order_item.rb
mechanize_store-0.0.14 app/models/mechanize_store/order_item.rb
mechanize_store-0.0.13 app/models/mechanize_store/order_item.rb
mechanize_store-0.0.12 app/models/mechanize_store/order_item.rb
mechanize_store-0.0.11 app/models/mechanize_store/order_item.rb
mechanize_store-0.0.10 app/models/mechanize_store/order_item.rb
mechanize_store-0.0.8 app/models/mechanize_store/order_item.rb
mechanize_store-0.0.7 app/models/mechanize_store/order_item.rb
mechanize_store-0.0.6 app/models/mechanize_store/order_item.rb