Many visual tweaks, suggested by Lan
[cs356-p2-videostore.git] / app / models / merchandise_purchase.rb
1 class MerchandisePurchase < Purchase
2   belongs_to :merchandise
3   belongs_to :customer
4
5   validates_presence_of :merchandise_id
6   validates_presence_of :quantity
7
8   validates_numericality_of :merchandise_id
9   validates_numericality_of :quantity
10
11   protected
12   def validate
13     errors.add(:merchandise_id, "does not exist in the database") if merchandise.nil?
14     #errors.add(:quantity, "must be 1 or greater") if quantity < 1
15   end
16 end