Why can't active resource deserialize this xml response?

Can anybody explain why active resource can’t deserialize this?

Active Resource class:

class Pownce < ActiveResource::Base
self.site = “http://api.pownce.com/1.0
end

class User < Pownce
end

Command I’m using:

User.find(:all, :from => ‘/users/eggie5/friends.xml’)

Resolves to this:

GET http://api.pownce.com:80/users/eggie5/friends.xml
→ 200 OK (<?xml version="1.0" encoding="utf-8"?>


casseeee
http://pownce.com/casseeee/
<short_name>cassee a.</short_name>
United States
20
<first_name>cassee</first_name>

Lady
<profile_photo_urls>
<smedium_photo_url>http://pownce.com/profile_photos/c/a/s/
casseeee/31250_smedium.jpg</smedium_photo_url>
<small_photo_url>http://pownce.com/profile_photos/c/a/s/
casseeee/31250_small.jpg</small_photo_url>
<tiny_photo_url>http://pownce.com/profile_photos/c/a/s/
casseeee/31250_tiny.jpg</tiny_photo_url>
<medium_photo_url>http://pownce.com/profile_photos/c/a/s/
casseeee/31250_medium.jpg</medium_photo_url>
<large_photo_url>http://pownce.com/profile_photos/c/a/s/
casseeee/31250_large.jpg</large_photo_url>
</profile_photo_urls>
<is_pro>0</is_pro>



elagothro
http://pownce.com/elagothro/
<short_name>Michael O.</short_name>
United States
22
<first_name>Michael</first_name>
PHP/MySQL Dev Lead for foliopod ( http://chicagofolio.com
& http://foliopod.com ) and CareerNoodle ( http://careernoodle.com
)
Dude
<profile_photo_urls>
<smedium_photo_url>http://pownce.com/profile_photos/e/l/a/
elagothro/96840_smedium.jpg</smedium_photo_url>
<small_photo_url>http://pownce.com/profile_photos/e/l/a/
elagothro/96840_small.jpg</small_photo_url>
<tiny_photo_url>http://pownce.com/profile_photos/e/l/a/
elagothro/96840_tiny.jpg</tiny_photo_url>
<medium_photo_url>http://pownce.com/profile_photos/e/l/a/
elagothro/96840_medium.jpg</medium_photo_url>
<large_photo_url>http://pownce.com/profile_photos/e/l/a/
elagothro/96840_large.jpg</large_photo_url>
</profile_photo_urls>
<is_pro>1</is_pro>
Chicago, IL

It’s simply a collection of 2 User objects. Can somebody enlighten me
as to why this won’t deserialize? This is the error:

NoMethodError: undefined method collect!' for #<Hash:0x12a86bc> from /usr/local/lib/ruby/gems/1.8/gems/activeresource-2.0.2/lib/ active_resource/base.rb:465:in instantiate_collection’
from /usr/local/lib/ruby/gems/1.8/gems/activeresource-2.0.2/lib/
active_resource/base.rb:439:in find_every' from /usr/local/lib/ruby/gems/1.8/gems/activeresource-2.0.2/lib/ active_resource/base.rb:385:in find’

try to change to

using this

xml.users(:type => ‘array’)

http://dev.rubyonrails.org/ticket/8798


Ettore

Doesn’t this effectively exclude any non-rails webservice from being
used with active resource?

Is this just acceptable to you?

On Dec 30, 7:23 am, Ettore B. [email protected]

This isn’t a rails webservice, so I can’t make those edits. This isn’t
a standard of rest or anything…

On Dec 30, 7:23 am, Ettore B. [email protected]