From ccbbf40584d5c1609a27822e46947d261370b022 Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 17 Aug 2010 11:48:59 -0700 Subject: [PATCH] validation lambda out to method --- app/models/user.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index 58d45c3c2..9b6410966 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -21,8 +21,11 @@ class User ######## Making things work ######## key :email, String - validates_true_for :email, :logic => lambda { |email| - email.include?('@pivotallabs.com') || email.include?('@pivotalsf.com')} + validates_true_for :email, :logic => lambda { self.pivotal_email?} + + def pivotal_email? + email.include?('@pivotallabs.com') + end def method_missing(method, *args) self.person.send(method, *args)