[Rails] AWS and array of Model

Háber János boci at freemind.hu
Fri Jan 6 18:46:56 GMT 2006


Hi!

I try to use a layered webservice and I want to get back an array of users;

In the API I use:
    api_method :listUsers,:returns=>[[User]]

in the service:
    def listUsers
        User.find(:all)
    end

Result in soap mode:

Don't know how to cast TrueClass to Object


Result in XML-RPC mode:

You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occured while evaluating nil.collect


It's work on another machine. (Here is windows)
I tried to create another ampty project with Only this model, and only 
one controller.

In controller used this code (the model is the default generated):
class UserAdminAPI < ActionWebService::API::Base
    api_method :listUsers,:returns=>[[User]]
end
   
class UserAdminService < ActionWebService::Base
    web_service_api UserAdminAPI
   
    def listUsers
        User.find(:all)
    end
end
   
class AdminController < ApplicationController
  wsdl_service_name 'Admin'
  web_service_dispatching_mode :delegated
  web_service_scaffold :invoke
  web_service(:user) { UserAdminService.new }
end

What's the problem? (If I change the return variable to :string and I in 
the implementation I use YAML.dump User.find(:all). It's get back the value.

the flul log: http://www.rafb.net/paste/results/PNmYct37.html


Cow


More information about the Rails mailing list