X-Git-Url: https://irasnyder.com/gitweb/?a=blobdiff_plain;f=app%2Fmodels%2Fcustomer.rb;h=acd686900f47ad7af523c214bee264541a460e41;hb=e4597521e3a7365f86731f7d69643cb1067acb5e;hp=673cffdfb01b3e4e22ec4c6197a83be2d6885672;hpb=93daca12cd904df11a8faadda08e487e9a4de8b7;p=cs356-p2-videostore.git diff --git a/app/models/customer.rb b/app/models/customer.rb index 673cffd..acd6869 100644 --- a/app/models/customer.rb +++ b/app/models/customer.rb @@ -1,6 +1,5 @@ class Customer < ActiveRecord::Base has_many :coitems - has_many :bitems has_many :merchandise_purchases has_many :rentable_purchases @@ -63,6 +62,8 @@ class Customer < ActiveRecord::Base 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