You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
See the subject. I'm not sure if this is really a bug, per se, but it's certainly an unintuitive problem.
In my particular situation I'm working with a form that has a key that represents a very high-value incremental id in the database. Serializing it provides a string not unlike the value in the subject.
The problem starts here:
$.deparam('foo[10000000]=bar'); // [undefined, undefined, undefined, 9999998 more...]
Converting this data back to a string will break the browser.
i have the same problem, when merging hash with key value like 123 the hash put in the url is many undefined parameters up to 122 hashes.
ex.: param[123]=1
if pushed creates 122 param with value undefined, and the last one is our param[123]=1
I just ran into the same issue with Rails' query string output for a hash with a numerical key and an array as the associated value. Passing hash[100][]=val to deparam with a numerical key would result in { hash: [ <100 nil entries>, "val" ] }.
I was able to work around it by pre-processing the params string so hash[1][]=a becomes hash['1'][]=a, which produces the desired { hash: { '1': [ "a" ] } }. Here's a bit of code that could be adapted to work without the empty brackets Rails adds:
See the subject. I'm not sure if this is really a bug, per se, but it's certainly an unintuitive problem.
In my particular situation I'm working with a form that has a key that represents a very high-value incremental id in the database. Serializing it provides a string not unlike the value in the subject.
The problem starts here:
$.deparam('foo[10000000]=bar'); // [undefined, undefined, undefined, 9999998 more...]
Converting this data back to a string will break the browser.
Working with objects would resolve this problem:
$.deparam('foo[10000000]=bar'); // { foo: {'1000': 'bar'} }
Not sure if this has any other functional implications, however.
The text was updated successfully, but these errors were encountered: