PDA

View Full Version : How to determine when params are sent as a hash or as an array of ordered arguments?



Gjslick
14 Dec 2009, 1:17 PM
It seems at this point, there is no way for the server side stack to determine if data arguments were provided in a parameter hash, or as an ordered array. When loading data through a store with paramsAsHash: true (the default), the JSON 'data' property provided to the server side stack is:

data: [ { param1: 'value1', param2: 'value2' } ]The problem is, the hash data is wrapped in an array, so there's no way to tell if the params were provided as a hash, or if the first element of the array should be provided as a key-value object to the first argument of the requested method.



It seems that the data should be provided to the server side stack as:

data: { param1: 'value1', param2: 'value2' }so that it can be tested to see if it's an object, and therefore to treat it as a parameter hash; or if it's an array, so it can be provided to a method's arguments by array element position.



Are hash parameters being send to the server side stack inside an array possibly a bug? Or am I just missing something here?