Skip to content
This repository
Browse code

Merge pull request #2319 from thedarkone/errors-include-3-1

Backport #2305 into 3-1-stable
  • Loading branch information...
commit ac24a53ffc0271d3188f56b5c730ec3b70c5fb47 2 parents 6f745f4 + 09dd71c
Santiago Pastorino authored July 28, 2011
2  activemodel/lib/active_model/errors.rb
@@ -86,7 +86,7 @@ def clear
86 86
 
87 87
     # Do the error messages include an error with key +error+?
88 88
     def include?(error)
89  
-      messages.include? error
  89
+      (v = messages[error]) && v.any?
90 90
     end
91 91
 
92 92
     # Get messages for +key+
1  activemodel/test/cases/errors_test.rb
@@ -38,6 +38,7 @@ def test_include?
38 38
     person.errors[:foo]
39 39
     assert person.errors.empty?
40 40
     assert person.errors.blank?
  41
+    assert !person.errors.include?(:foo)
41 42
   end
42 43
 
43 44
   test "method validate! should work" do

0 notes on commit ac24a53

Please sign in to comment.
Something went wrong with that request. Please try again.