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'' --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ettore Berardi
2007-Dec-30 15:23 UTC
Re: Why can''t active resource deserialize this xml response?
try to change <users> to <users type=''array''> using this xml.users(:type => ''array'') http://dev.rubyonrails.org/ticket/8798 ----- Ettore -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
eggie5
2007-Dec-30 18:57 UTC
Re: Why can''t active resource deserialize this xml response?
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 Berardi <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> try to change <users> to <users type=''array''> > > using this > > xml.users(:type => ''array'') > > http://dev.rubyonrails.org/ticket/8798 > > ----- > Ettore > > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
eggie5
2007-Dec-30 18:59 UTC
Re: Why can''t active resource deserialize this xml response?
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 Berardi <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> try to change <users> to <users type=''array''> > > using this > > xml.users(:type => ''array'') > > http://dev.rubyonrails.org/ticket/8798 > > ----- > Ettore > > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---