aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2012-12-26 20:20:02 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2012-12-26 20:20:02 -0300
commitd38c8caa48a732d41c7402a5e71deece4e313559 (patch)
tree59773c8496352442f5ea67b817ab18d38e91fb63 /activemodel/lib
parent93366c7c913bf0883f140fa782d3e198593477be (diff)
downloadrails-d38c8caa48a732d41c7402a5e71deece4e313559.tar.gz
rails-d38c8caa48a732d41c7402a5e71deece4e313559.tar.bz2
rails-d38c8caa48a732d41c7402a5e71deece4e313559.zip
Revert "Fix `validates_presence_of` with `:allow_nil` or `:allow_blank` options."
This reverts commit 93366c7c913bf0883f140fa782d3e198593477be. REASON: This is backward incompatible. Also this behavior is documented on the guides.
Diffstat (limited to 'activemodel/lib')
-rw-r--r--activemodel/lib/active_model/validations/presence.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/activemodel/lib/active_model/validations/presence.rb b/activemodel/lib/active_model/validations/presence.rb
index 20a57e3c59..efd1372a6b 100644
--- a/activemodel/lib/active_model/validations/presence.rb
+++ b/activemodel/lib/active_model/validations/presence.rb
@@ -4,8 +4,8 @@ module ActiveModel
# == Active Model Presence Validator
module Validations
class PresenceValidator < EachValidator
- def validate_each(record, attr_name, value)
- record.errors.add(attr_name, :blank, options) if value.blank?
+ def validate(record)
+ record.errors.add_on_blank(attributes, options)
end
end
@@ -39,7 +39,7 @@ module ActiveModel
# if the validation should not occur (e.g. <tt>:unless => :skip_validation</tt>,
# or <tt>:unless => Proc.new { |user| user.signup_step <= 2 }</tt>). The method,
# proc or string should return or evaluate to a true or false value.
- # * <tt>:strict</tt> - Specifies whether validation should be strict.
+ # * <tt>:strict</tt> - Specifies whether validation should be strict.
# See <tt>ActiveModel::Validation#validates!</tt> for more information.
def validates_presence_of(*attr_names)
validates_with PresenceValidator, _merge_attributes(attr_names)