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"?> <users> <user> <username>casseeee</username> <permalink>http://pownce.com/casseeee/</permalink> <short_name>cassee a.</short_name> <country>United States</country> <age>20</age> <first_name>cassee</first_name> <blurb></blurb> <gender>Lady</gender> <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> <location></location> </user> <user> <username>elagothro</username> <permalink>http://pownce.com/elagothro/</permalink> <short_name>Michael O.</short_name> <country>United States</country> <age>22</age> <first_name>Michael</first_name> <blurb>PHP/MySQL Dev Lead for foliopod ( http://chicagofolio.com & http://foliopod.com ) and CareerNoodle ( http://careernoodle.com )</blurb> <gender>Dude</gender> <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> <location>Chicago, IL</location> </user> </users>
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'