From 02e881436881a40cacb1e92c0dc61183b6f47242 Mon Sep 17 00:00:00 2001 From: Andrew Nesbitt Date: Thu, 15 May 2008 01:12:18 +0100 Subject: [PATCH] added check to see if model is valid before adding error to base, to retain all validation errors without extra controller code --- lib/recaptcha.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/recaptcha.rb b/lib/recaptcha.rb index 78655531..af9fbe44 100644 --- a/lib/recaptcha.rb +++ b/lib/recaptcha.rb @@ -51,6 +51,7 @@ def verify_recaptcha(model = nil) answer, error = recaptcha.body.split.map(&:chomp) unless answer == 'true' session[:recaptcha_error] = error + model.valid? if model model.errors.add_to_base "Captcha response is incorrect, please try again." if model return false else