From 78fd14c8de9577f92ee78ba399ca716589465465 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Wed, 26 Dec 2012 18:20:48 -0300 Subject: Revert the change at ActiveModel::Errors#add_on_blank and fix in the right place. The EachValidator#validate already handle :allow_blank and :allow_nil, correctly. Closes #8622. Fix #8621. --- activemodel/lib/active_model/validations/presence.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'activemodel/lib/active_model/validations') diff --git a/activemodel/lib/active_model/validations/presence.rb b/activemodel/lib/active_model/validations/presence.rb index ae84c376b9..ab8c8359fc 100644 --- a/activemodel/lib/active_model/validations/presence.rb +++ b/activemodel/lib/active_model/validations/presence.rb @@ -3,8 +3,8 @@ module ActiveModel module Validations class PresenceValidator < EachValidator # :nodoc: - def validate(record) - record.errors.add_on_blank(attributes, options) + def validate_each(record, attr_name, value) + record.errors.add(attr_name, :blank, options) if value.blank? end end -- cgit v1.2.3