+
+ def overdue?
+ return due_date < Time.now.to_date
+ end
+
+ def late_fee
+ days_late = Time.now.to_date - (due_date)
+ if rentable.class == Video
+ return VideoPolicy.find_by_day(7).fee * days_late.to_i
+ else
+ return GamePolicy.find_by_day(7).fee * days_late.to_i
+ end
+ end
+
+ protected
+ def validate
+ errors.add(:customer_id, "does not exist is the database") if customer.nil?
+ errors.add(:rentable_id, "does not exist in the database") if rentable.nil?
+ end