projects
/
cs356-p2-videostore.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Many visual tweaks, suggested by Lan
[cs356-p2-videostore.git]
/
app
/
models
/
coitem.rb
diff --git
a/app/models/coitem.rb
b/app/models/coitem.rb
index
513625a
..
b9d9024
100644
(file)
--- a/
app/models/coitem.rb
+++ b/
app/models/coitem.rb
@@
-21,6
+21,11
@@
class Coitem < ActiveRecord::Base
return due_date < Time.now.to_date
end
return due_date < Time.now.to_date
end
+ def late_fee
+ days_late = Time.now.to_date - (due_date)
+ return VideoPolicy.find_by_day(8).fee * days_late.to_i
+ end
+
protected
def validate
errors.add(:customer_id, "does not exist is the database") if customer.nil?
protected
def validate
errors.add(:customer_id, "does not exist is the database") if customer.nil?