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

17 lines
326 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-04-08 07:35:00 +02:00
if item
item.name + " " + count.to_s + " " + price.to_s
else
" no item "
end
2015-03-14 06:33:49 +01:00
end
end