aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib/active_model/validations
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2012-12-21 17:04:37 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2012-12-21 17:06:18 -0300
commitb437053b5b5c04712b9bf851353d08cff0600430 (patch)
treebae6cb830b587cf0d2ffffe22d95ab0e86f9a414 /activemodel/lib/active_model/validations
parent8ee1c26abcb39dded64c4dacb945292769392469 (diff)
downloadrails-b437053b5b5c04712b9bf851353d08cff0600430.tar.gz
rails-b437053b5b5c04712b9bf851353d08cff0600430.tar.bz2
rails-b437053b5b5c04712b9bf851353d08cff0600430.zip
Remove ActiveModel::Errors#add_on_present method.
We don't need to define a new method in ActiveMode::Errors for each validatior. See https://github.com/rails/rails/commit/d72a07f1d1478db9daed847eadb35bfd840674f6#commitcomment-2325333
Diffstat (limited to 'activemodel/lib/active_model/validations')
-rw-r--r--activemodel/lib/active_model/validations/absence.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activemodel/lib/active_model/validations/absence.rb b/activemodel/lib/active_model/validations/absence.rb
index 6790554907..2c6df60020 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, :not_blank, options) if value.present?
end
end