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
/
purchase.rb
diff --git
a/app/models/purchase.rb
b/app/models/purchase.rb
index
ff07e41
..
26cf518
100644
(file)
--- a/
app/models/purchase.rb
+++ b/
app/models/purchase.rb
@@
-6,6
+6,14
@@
class Purchase < ActiveRecord::Base
validates_presence_of :price
validates_numericality_of :price
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
protected
def validate
errors.add(:price, "cannot be negative") if price < 0