diff options
Diffstat (limited to 'activemodel/lib/active_model/validations')
| -rw-r--r-- | activemodel/lib/active_model/validations/absence.rb | 4 | ||||
| -rw-r--r-- | activemodel/lib/active_model/validations/presence.rb | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/activemodel/lib/active_model/validations/absence.rb b/activemodel/lib/active_model/validations/absence.rb index 6790554907..1a1863370b 100644 --- a/activemodel/lib/active_model/validations/absence.rb +++ b/activemodel/lib/active_model/validations/absence.rb @@ -2,8 +2,8 @@ module ActiveModel module Validations # == Active Model Absence Validator class AbsenceValidator < EachValidator #:nodoc: - def validate(record) - record.errors.add_on_present(attributes, options) + def validate_each(record, attr_name, value) + record.errors.add(attr_name, :present, options) if value.present? end end 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 |
