I've been getting errors with the find_every routine whenever I try to get a list of items when there are either only zero or one item.
Since I'm a bit of a nube, I assume that this is an error in the our server code. However, I also found that everything worked much better when I patched the routine with the following code. It seemed to handle all of the cases with grace and ease.
Is this likely a stupid error in the server rendering? or is this a valid patch?
private # { :people => { :person => [ person1, person2 ] } } def find_every(options) data = connection.get(collection_path(options)) if data.values.first.nil? else if data.values.first.values.first.class == Array data.values.first.values.first.collect { |element| new(element, options) } else # It is a HASH data.values.first.values.collect { |element| new(element, options) } end end end
- Reid