1 class Merchandise < ActiveRecord::Base
2 validates_presence_of :name
3 validates_numericality_of :quantity
4 validates_numericality_of :price
8 errors.add(:quantity, "cannot be negative") if quantity < 0
9 errors.add(:price, "cannot be negative") if price < 0
10 errors.add(:price, "cannot be less than $0.01") if price < 0.01