From: Ira W. Snyder Date: Mon, 26 Nov 2007 06:37:08 +0000 (-0800) Subject: Update Rails + Add Phone Number and Email Validation X-Git-Tag: turned-in~29 X-Git-Url: https://www.irasnyder.com/gitweb/?a=commitdiff_plain;h=11b4d4103e1c24cb773216b9116d260734395f3c;p=cs356-p2-videostore.git Update Rails + Add Phone Number and Email Validation Signed-off-by: Ira W. Snyder --- diff --git a/app/models/customer.rb b/app/models/customer.rb index 5509439..acd6869 100644 --- 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 + 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 diff --git a/config/environment.rb b/config/environment.rb index 4233311..ab75a0f 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -5,7 +5,7 @@ # ENV['RAILS_ENV'] ||= 'production' # Specifies gem version of Rails to use when vendor/rails is not present -RAILS_GEM_VERSION = '1.2.5' unless defined? RAILS_GEM_VERSION +RAILS_GEM_VERSION = '1.2.6' unless defined? RAILS_GEM_VERSION # Bootstrap the Rails environment, frameworks, and default configuration require File.join(File.dirname(__FILE__), 'boot') diff --git a/db/development.sqlite3 b/db/development.sqlite3 index 0a336e5..86d8540 100644 Binary files a/db/development.sqlite3 and b/db/development.sqlite3 differ diff --git a/public/stylesheets/videostore.css b/public/stylesheets/videostore.css deleted file mode 100644 index e2de91b..0000000 --- a/public/stylesheets/videostore.css +++ /dev/null @@ -1,13 +0,0 @@ -h1#header { - font: 400% sans-serif; - color: yellow; - padding: 0em; - margin: 0em; -} - -div#header { - background-color: green; - height: 8em; - margin: 0em; - text-align: center; -}