Manuel Holtgrewe
2006-Jan-31 17:16 UTC
[Rails] How to use nested arrays in ActionWebService?
Hi list. I am writing a data structure definition for my web service API that has - besides others - a nested array of integers: I want to have an array that contains arrays which themselves contain two integer values. An example for this is: [ [1, 2], [2, 400] ] These values represent a distribution and in this exapmmle this means that the event "hit 1 time" occured two times and "hit 2 times" occured 400 times. When I try to implement this the following way I get an error ("nil where it was not expected, maybe you wanted an array instead"): class ProductStatistics < ActionWebService::Struct member :name, :string member :hit_distribution, [[:int]] end When I changed this to a flat integer array, it worked: class ProductStatistics < ActionWebService::Struct member :name, :string member :hit_distribution, [:int] end Now, my question: Is it possible to specify that I want nested arrays of integers in my web service API and if yes: how? Regards, Manuel Holtgrewe