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:
parent
035d31bd93
commit
45f9c2b361
2 changed files with 2 additions and 1 deletions
|
@ -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+
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue