Permalink
Browse files

Handle either error string or array

  • Loading branch information...
1 parent 24ac1d6 commit 78c6f48b26777a3725505d0cb3ec4af483bf9a95 @jeremy jeremy committed Feb 7, 2009
Showing with 1 addition and 1 deletion.
  1. +1 −1 activeresource/lib/active_resource/validations.rb
@@ -203,7 +203,7 @@ def size
def from_xml(xml)
clear
humanized_attributes = @base.attributes.keys.inject({}) { |h, attr_name| h.update(attr_name.humanize => attr_name) }
- messages = Hash.from_xml(xml)['errors']['error'] rescue []
+ messages = Array.wrap(Hash.from_xml(xml)['errors']['error']) rescue []
messages.each do |message|
attr_message = humanized_attributes.keys.detect do |attr_name|
if message[0, attr_name.size + 1] == "#{attr_name} "

0 comments on commit 78c6f48

Please sign in to comment.