From ebaf4e40cdcb80ebe16014a2c979f688213d7b92 Mon Sep 17 00:00:00 2001 From: Robson Marques Date: Fri, 19 Dec 2014 15:26:41 -0200 Subject: Fix inaccurate docs in active_model errors [ci skip] The default value for the argument `message` in `ActiveModel::Errors#add` has a new behavior since ca99ab2481d44d67bc392d0ec1125ff1439e9f94. Before person.errors.add(:name, nil) # => ["is invalid"] After person.errors.add(:name, nil) # => [nil] --- activemodel/lib/active_model/errors.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'activemodel') diff --git a/activemodel/lib/active_model/errors.rb b/activemodel/lib/active_model/errors.rb index 9105ef5dd6..55687cb3c7 100644 --- a/activemodel/lib/active_model/errors.rb +++ b/activemodel/lib/active_model/errors.rb @@ -283,9 +283,9 @@ module ActiveModel # ActiveModel::StrictValidationFailed instead of adding the error. # :strict option can also be set to any other exception. # - # person.errors.add(:name, nil, strict: true) + # person.errors.add(:name, :invalid, strict: true) # # => ActiveModel::StrictValidationFailed: name is invalid - # person.errors.add(:name, nil, strict: NameIsInvalid) + # person.errors.add(:name, :invalid, strict: NameIsInvalid) # # => NameIsInvalid: name is invalid # # person.errors.messages # => {} -- cgit v1.2.3