1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Handle the empty array correctly.

This commit is contained in:
thedarkone 2011-07-27 18:07:47 +02:00 committed by Xavier Noria
parent 035d31bd93
commit 45f9c2b361
2 changed files with 2 additions and 1 deletions

View file

@ -86,7 +86,7 @@ module ActiveModel
# Do the error messages include an error with key +error+?
def include?(error)
messages.include? error
(v = messages[error]) && v.any?
end
# Get messages for +key+

View file

@ -38,6 +38,7 @@ class ErrorsTest < ActiveModel::TestCase
person.errors[:foo]
assert person.errors.empty?
assert person.errors.blank?
assert !person.errors.include?(:foo)
end
test "method validate! should work" do