Skip to content

Commit

Permalink
Handle the empty array correctly.
Browse files Browse the repository at this point in the history
  • Loading branch information
thedarkone committed Jul 27, 2011
1 parent 02691d3 commit efe4cbe
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion activemodel/lib/active_model/errors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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+
Expand Down
1 change: 1 addition & 0 deletions activemodel/test/cases/errors_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit efe4cbe

Please sign in to comment.