Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Handle the empty array correctly.

  • Loading branch information...
commit 45f9c2b3619d96867f9c6af7c16d2f5d53f1a17e 1 parent 035d31b
@thedarkone thedarkone authored fxn committed
View
2  activemodel/lib/active_model/errors.rb
@@ -86,7 +86,7 @@ def clear
# 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
1  activemodel/test/cases/errors_test.rb
@@ -38,6 +38,7 @@ def test_include?
person.errors[:foo]
assert person.errors.empty?
assert person.errors.blank?
+ assert !person.errors.include?(:foo)
end
test "method validate! should work" do
Please sign in to comment.
Something went wrong with that request. Please try again.