Open koryteg opened 9 years ago
this issue is actually FormData
doing a join or something on the array. as you can see here https://github.com/funtusov/ember-cli-form-data/blob/master/addon/mixins/form-data-adapter.js#L35 you are just passing the value in. but FormData reformats it. I am not really sure what the work around is for this.
2 separate requests?
Hey @koryteg thanks for filing an issue! Could you please copy the exact request that gets sent in your case and specify the version of ember-data that you're using?
I am using ember data 1.13.8
I have a slug: attr('string')
attribute with a value of asdf!
. Here's how it looks in the payload (disableRoot: true
):
------WebKitFormBoundaryIeH9hzmqnKbfDBnN
Content-Disposition: form-data; name="0"
a
------WebKitFormBoundaryIeH9hzmqnKbfDBnN
Content-Disposition: form-data; name="1"
d
------WebKitFormBoundaryIeH9hzmqnKbfDBnN
Content-Disposition: form-data; name="2"
s
------WebKitFormBoundaryIeH9hzmqnKbfDBnN
Content-Disposition: form-data; name="3"
f
------WebKitFormBoundaryIeH9hzmqnKbfDBnN
Content-Disposition: form-data; name="4"
!
------WebKitFormBoundaryIeH9hzmqnKbfDBnN--
With disableRoot: false
names are slug[0]
, slug[1]
...
The cause of the problem is that here:
hash.data = this._getFormData(data);
data
is a hash of record attributes, while the addon seems to expect it to be a hash of hashes (unnecessary Object.keys(data[root]).forEach
).
PS Ember Data 2.7.
I do not have time in the moment to look through the code and make a pr and what not. so I am just making a note here for me to come back to. when I add the mixin to my adapter it messes up the serialization of other attributes. I have
user_ids
that should be headed up to the server as an array of strings like so["1", "2", "3"]
but actually gets sent up as just a string like this:"1,2,3"
.