Files
old-ribica/back-office/app/models/item_in_cart.rb

13 lines
276 B
Ruby
Raw Normal View History

class ItemInCart < ActiveRecord::Base
belongs_to :cart
belongs_to :item
validates_uniqueness_of :item_id, scope: :cart_id
validates :item_id, presence: true
validates :cart_id, presence: true
2015-03-14 06:33:49 +01:00
def name
2015-03-14 06:33:49 +01:00
item.name + " " + count.to_s + " " + price.to_s
end
end