From 1457b57128e80e8e831b17382fa613856d67293c Mon Sep 17 00:00:00 2001 From: August Lilleaas Date: Mon, 9 Mar 2009 21:32:55 +0100 Subject: [PATCH] Explicitly calling .inspect on the regex so that we get the proper format. We don't want Regex#to_s. --- lib/live_validations/adapters/jquery_validations.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/live_validations/adapters/jquery_validations.rb b/lib/live_validations/adapters/jquery_validations.rb index e83d59a..46cbd7c 100644 --- a/lib/live_validations/adapters/jquery_validations.rb +++ b/lib/live_validations/adapters/jquery_validations.rb @@ -72,7 +72,7 @@ class JqueryValidations < LiveValidations::Adapter end validates :format do |v, attribute| - regex = v.format_regex + regex = v.format_regex.inspect add_custom_rule(v, attribute, Digest::SHA1.hexdigest(regex.inspect), "return #{regex}.test(value)", v.message_for(:invalid)) end