From bc7c0b5c108ef47b24bb91c502429935bb34d214 Mon Sep 17 00:00:00 2001
From: MrBrdo <mrbrdo@gmail.com>
Date: Fri, 8 Jun 2012 00:08:51 +0200
Subject: prevent users from unknowingly using bad regexps that can compromise
 security
 (http://homakov.blogspot.co.uk/2012/05/saferweb-injects-in-various-ruby.html)

---
 guides/source/active_model_basics.textile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'guides/source/active_model_basics.textile')

diff --git a/guides/source/active_model_basics.textile b/guides/source/active_model_basics.textile
index d373f4ac85..7cafff2ad8 100644
--- a/guides/source/active_model_basics.textile
+++ b/guides/source/active_model_basics.textile
@@ -187,7 +187,7 @@ class Person
   attr_accessor :name, :email, :token
   
   validates :name, :presence => true
-  validates_format_of :email, :with => /^([^\s]+)((?:[-a-z0-9]\.)[a-z]{2,})$/i  
+  validates_format_of :email, :with => /\A([^\s]+)((?:[-a-z0-9]\.)[a-z]{2,})\z/i  
   validates! :token, :presence => true
   
 end
-- 
cgit v1.2.3

