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
/
customer.rb
diff --git
a/app/models/customer.rb
b/app/models/customer.rb
index
5509439
..
acd6869
100644
(file)
--- a/
app/models/customer.rb
+++ b/
app/models/customer.rb
@@
-62,6
+62,8
@@
class Customer < ActiveRecord::Base
def validate
errors.add(:debt, "should be non-negative") if debt.nil? || debt < 0.00
def validate
errors.add(:debt, "should be non-negative") if debt.nil? || debt < 0.00
+ errors.add(:email, "is invalid") unless email =~ /.+@.+\..+/
+ errors.add(:phone, "has invalid format, use XXX-XXX-XXXX") unless phone =~ /^\d{3}-\d{3}-\d{4}$/
end
end
end
end