diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2009-02-06 20:26:24 -0800 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2009-02-06 20:26:24 -0800 |
commit | 78c6f48b26777a3725505d0cb3ec4af483bf9a95 (patch) | |
tree | 7bc3b61b088590b8ca34181bbfe22b676cdc01d0 /activeresource | |
parent | 24ac1d6bdc860d234e70dd4cd4713bd13ac9d40d (diff) | |
download | rails-78c6f48b26777a3725505d0cb3ec4af483bf9a95.tar.gz rails-78c6f48b26777a3725505d0cb3ec4af483bf9a95.tar.bz2 rails-78c6f48b26777a3725505d0cb3ec4af483bf9a95.zip |
Handle either error string or array
Diffstat (limited to 'activeresource')
-rw-r--r-- | activeresource/lib/active_resource/validations.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activeresource/lib/active_resource/validations.rb b/activeresource/lib/active_resource/validations.rb index 4bc906d291..de3339935f 100644 --- a/activeresource/lib/active_resource/validations.rb +++ b/activeresource/lib/active_resource/validations.rb @@ -203,7 +203,7 @@ module ActiveResource 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} " |