Gianluca Tessarolo
2007-Nov-12 11:23 UTC
REST: Did ActiveResource code broken ? Can''t handle Resource.find(:all)...
Hi to all, I just started with REST development, I created a very simple scaffold_resource and a client app to test it. All verbs works well but not list !!! Here what I give when call Airport.find(:all) ./activeresource/lib/active_resource/base.rb:465:in `instantiate_collection'': undefined method `collect!'' for #<Hash:0xb7b90ac0> (NoMethodError) from ./activeresource/lib/active_resource/base.rb:442:in `find_every'' from ./activeresource/lib/active_resource/base.rb:385:in `find'' from client.rb:10:in `show_airports'' from client.rb:16 Did ActiveResource code broken ? Here what I''ve generated with scaffold_resource: ruby script/generate scaffold_resource airport name:string rake db:migrate And here my (very simple) client.rb source: require ''activesupport/lib/active_support'' require ''activeresource/lib/active_resource'' # Define a model for the objects exposed by the site class Airport < ActiveResource::Base self.site = ''http://localhost:3000/'' end def show_airports airports = Airport.find(:all) puts "I retrieved #{airports.size} airports !" end new_airport = Airport.new(:name => "New airport") new_airport.save show_airports Someone can help me ? Thanks in advance... --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---