validates_presence_of :price
validates_numericality_of :price
+ def title
+ if type == MerchandisePurchase
+ return merchandise.title
+ else
+ return rentable.title
+ end
+ end
+
protected
def validate
errors.add(:price, "cannot be negative") if price < 0