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...