{"action":"created","comment":{"url":"https://api.github.com/repos/funtusov/ember-cli-form-data/pulls/comments/29283497","id":29283497,"diff_hunk":"@@ -13,13 +13,16 @@ export default Ember.Mixin.create({\n \n     if (typeof FormData !== 'undefined' && data && this.formDataTypes.contains(type)) {\n       var formData = new FormData();\n-      var root = Ember.keys(data)[0];\n-\n-      Ember.keys(data[root]).forEach(function(key) {\n-        if (typeof data[root][key] !== 'undefined') {\n-          formData.append(root + \"[\" + key + \"]\", data[root][key]);\n+      var fields = this.getDataToTransform(data);\n+\n+      Ember.keys(fields).forEach(function(key) {\n+        if (typeof fields[key] !== 'undefined') {\n+          formData.append(\n+            this.getFormKey(key, fields),\n+            this.getFormValue(key, fields)","path":"addon/mixins/form-data-adapter.js","position":15,"original_position":15,"commit_id":"7090bb15c3030e05c9c311d8de69c01ca9abfa6e","original_commit_id":"7090bb15c3030e05c9c311d8de69c01ca9abfa6e","user":{"login":"funtusov","id":706445,"avatar_url":"https://avatars.githubusercontent.com/u/706445?v=3","gravatar_id":"","url":"https://api.github.com/users/funtusov","html_url":"https://github.com/funtusov","followers_url":"https://api.github.com/users/funtusov/followers","following_url":"https://api.github.com/users/funtusov/following{/other_user}","gists_url":"https://api.github.com/users/funtusov/gists{/gist_id}","starred_url":"https://api.github.com/users/funtusov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/funtusov/subscriptions","organizations_url":"https://api.github.com/users/funtusov/orgs","repos_url":"https://api.github.com/users/funtusov/repos","events_url":"https://api.github.com/users/funtusov/events{/privacy}","received_events_url":"https://api.github.com/users/funtusov/received_events","type":"User","site_admin":false},"body":"Could you please clarify, why do we need both the iteration over ``fields`` and passing the whole ``fields`` array to those functions from within the iterations? I.e. couldn't we do something like ``this.getFormKey(key, fields[key])`` ","created_at":"2015-04-28T20:16:58Z","updated_at":"2015-04-28T20:16:58Z","html_url":"https://github.com/funtusov/ember-cli-form-data/pull/5#discussion_r29283497","pull_request_url":"https://api.github.com/repos/funtusov/ember-cli-form-data/pulls/5","_links":{"self":{"href":"https://api.github.com/repos/funtusov/ember-cli-form-data/pulls/comments/29283497"},"html":{"href":"https://github.com/funtusov/ember-cli-form-data/pull/5#discussion_r29283497"},"pull_request":{"href":"https://api.github.com/repos/funtusov/ember-cli-form-data/pulls/5"}}},"pull_request":{"url":"https://api.github.com/repos/funtusov/ember-cli-form-data/pulls/5","id":34127898,"html_url":"https://github.com/funtusov/ember-cli-form-data/pull/5","diff_url":"https://github.com/funtusov/ember-cli-form-data/pull/5.diff","patch_url":"https://github.com/funtusov/ember-cli-form-data/pull/5.patch","issue_url":"https://api.github.com/repos/funtusov/ember-cli-form-data/issues/5","number":5,"state":"open","locked":false,"title":"Improving customization","user":{"login":"lodr","id":757942,"avatar_url":"https://avatars.githubusercontent.com/u/757942?v=3","gravatar_id":"","url":"https://api.github.com/users/lodr","html_url":"https://github.com/lodr","followers_url":"https://api.github.com/users/lodr/followers","following_url":"https://api.github.com/users/lodr/following{/other_user}","gists_url":"https://api.github.com/users/lodr/gists{/gist_id}","starred_url":"https://api.github.com/users/lodr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lodr/subscriptions","organizations_url":"https://api.github.com/users/lodr/orgs","repos_url":"https://api.github.com/users/lodr/repos","events_url":"https://api.github.com/users/lodr/events{/privacy}","received_events_url":"https://api.github.com/users/lodr/received_events","type":"User","site_admin":false},"body":"In a project I'm working on, we choose to not wrap server responses. FormData Adapter seems pretty good but it assumes a rooted serialization. This alternative implementation does the same but allows the developer for further customization of **what to be serialized** into form data and how this serialization must to be done. What do you think?\r\n\r\nThanks for the plugin anyway!","created_at":"2015-04-26T19:00:08Z","updated_at":"2015-04-28T20:16:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5e044faf7eddb2c3ceb3db00c0ed9759e877b2b6","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/funtusov/ember-cli-form-data/pulls/5/commits","review_comments_url":"https://api.github.com/repos/funtusov/ember-cli-form-data/pulls/5/comments","review_comment_url":"https://api.github.com/repos/funtusov/ember-cli-form-data/pulls/comments{/number}","comments_url":"https://api.github.com/repos/funtusov/ember-cli-form-data/issues/5/comments","statuses_url":"https://api.github.com/repos/funtusov/ember-cli-form-data/statuses/7090bb15c3030e05c9c311d8de69c01ca9abfa6e","head":{"label":"lodr:improved-customization","ref":"improved-customization","sha":"7090bb15c3030e05c9c311d8de69c01ca9abfa6e","user":{"login":"lodr","id":757942,"avatar_url":"https://avatars.githubusercontent.com/u/757942?v=3","gravatar_id":"","url":"https://api.github.com/users/lodr","html_url":"https://github.com/lodr","followers_url":"https://api.github.com/users/lodr/followers","following_url":"https://api.github.com/users/lodr/following{/other_user}","gists_url":"https://api.github.com/users/lodr/gists{/gist_id}","starred_url":"https://api.github.com/users/lodr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lodr/subscriptions","organizations_url":"https://api.github.com/users/lodr/orgs","repos_url":"https://api.github.com/users/lodr/repos","events_url":"https://api.github.com/users/lodr/events{/privacy}","received_events_url":"https://api.github.com/users/lodr/received_events","type":"User","site_admin":false},"repo":{"id":34625313,"name":"ember-cli-form-data","full_name":"lodr/ember-cli-form-data","owner":{"login":"lodr","id":757942,"avatar_url":"https://avatars.githubusercontent.com/u/757942?v=3","gravatar_id":"","url":"https://api.github.com/users/lodr","html_url":"https://github.com/lodr","followers_url":"https://api.github.com/users/lodr/followers","following_url":"https://api.github.com/users/lodr/following{/other_user}","gists_url":"https://api.github.com/users/lodr/gists{/gist_id}","starred_url":"https://api.github.com/users/lodr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lodr/subscriptions","organizations_url":"https://api.github.com/users/lodr/orgs","repos_url":"https://api.github.com/users/lodr/repos","events_url":"https://api.github.com/users/lodr/events{/privacy}","received_events_url":"https://api.github.com/users/lodr/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/lodr/ember-cli-form-data","description":"Ember CLI addon that adds FormData file uploads to Ember Data","fork":true,"url":"https://api.github.com/repos/lodr/ember-cli-form-data","forks_url":"https://api.github.com/repos/lodr/ember-cli-form-data/forks","keys_url":"https://api.github.com/repos/lodr/ember-cli-form-data/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lodr/ember-cli-form-data/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lodr/ember-cli-form-data/teams","hooks_url":"https://api.github.com/repos/lodr/ember-cli-form-data/hooks","issue_events_url":"https://api.github.com/repos/lodr/ember-cli-form-data/issues/events{/number}","events_url":"https://api.github.com/repos/lodr/ember-cli-form-data/events","assignees_url":"https://api.github.com/repos/lodr/ember-cli-form-data/assignees{/user}","branches_url":"https://api.github.com/repos/lodr/ember-cli-form-data/branches{/branch}","tags_url":"https://api.github.com/repos/lodr/ember-cli-form-data/tags","blobs_url":"https://api.github.com/repos/lodr/ember-cli-form-data/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lodr/ember-cli-form-data/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lodr/ember-cli-form-data/git/refs{/sha}","trees_url":"https://api.github.com/repos/lodr/ember-cli-form-data/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lodr/ember-cli-form-data/statuses/{sha}","languages_url":"https://api.github.com/repos/lodr/ember-cli-form-data/languages","stargazers_url":"https://api.github.com/repos/lodr/ember-cli-form-data/stargazers","contributors_url":"https://api.github.com/repos/lodr/ember-cli-form-data/contributors","subscribers_url":"https://api.github.com/repos/lodr/ember-cli-form-data/subscribers","subscription_url":"https://api.github.com/repos/lodr/ember-cli-form-data/subscription","commits_url":"https://api.github.com/repos/lodr/ember-cli-form-data/commits{/sha}","git_commits_url":"https://api.github.com/repos/lodr/ember-cli-form-data/git/commits{/sha}","comments_url":"https://api.github.com/repos/lodr/ember-cli-form-data/comments{/number}","issue_comment_url":"https://api.github.com/repos/lodr/ember-cli-form-data/issues/comments{/number}","contents_url":"https://api.github.com/repos/lodr/ember-cli-form-data/contents/{+path}","compare_url":"https://api.github.com/repos/lodr/ember-cli-form-data/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lodr/ember-cli-form-data/merges","archive_url":"https://api.github.com/repos/lodr/ember-cli-form-data/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lodr/ember-cli-form-data/downloads","issues_url":"https://api.github.com/repos/lodr/ember-cli-form-data/issues{/number}","pulls_url":"https://api.github.com/repos/lodr/ember-cli-form-data/pulls{/number}","milestones_url":"https://api.github.com/repos/lodr/ember-cli-form-data/milestones{/number}","notifications_url":"https://api.github.com/repos/lodr/ember-cli-form-data/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lodr/ember-cli-form-data/labels{/name}","releases_url":"https://api.github.com/repos/lodr/ember-cli-form-data/releases{/id}","created_at":"2015-04-26T18:34:20Z","updated_at":"2015-04-26T18:34:20Z","pushed_at":"2015-04-26T18:47:32Z","git_url":"git://github.com/lodr/ember-cli-form-data.git","ssh_url":"git@github.com:lodr/ember-cli-form-data.git","clone_url":"https://github.com/lodr/ember-cli-form-data.git","svn_url":"https://github.com/lodr/ember-cli-form-data","homepage":null,"size":99,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"funtusov:master","ref":"master","sha":"bfd6420d2cd2dadf2589b946fe46bceff6989764","user":{"login":"funtusov","id":706445,"avatar_url":"https://avatars.githubusercontent.com/u/706445?v=3","gravatar_id":"","url":"https://api.github.com/users/funtusov","html_url":"https://github.com/funtusov","followers_url":"https://api.github.com/users/funtusov/followers","following_url":"https://api.github.com/users/funtusov/following{/other_user}","gists_url":"https://api.github.com/users/funtusov/gists{/gist_id}","starred_url":"https://api.github.com/users/funtusov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/funtusov/subscriptions","organizations_url":"https://api.github.com/users/funtusov/orgs","repos_url":"https://api.github.com/users/funtusov/repos","events_url":"https://api.github.com/users/funtusov/events{/privacy}","received_events_url":"https://api.github.com/users/funtusov/received_events","type":"User","site_admin":false},"repo":{"id":29819222,"name":"ember-cli-form-data","full_name":"funtusov/ember-cli-form-data","owner":{"login":"funtusov","id":706445,"avatar_url":"https://avatars.githubusercontent.com/u/706445?v=3","gravatar_id":"","url":"https://api.github.com/users/funtusov","html_url":"https://github.com/funtusov","followers_url":"https://api.github.com/users/funtusov/followers","following_url":"https://api.github.com/users/funtusov/following{/other_user}","gists_url":"https://api.github.com/users/funtusov/gists{/gist_id}","starred_url":"https://api.github.com/users/funtusov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/funtusov/subscriptions","organizations_url":"https://api.github.com/users/funtusov/orgs","repos_url":"https://api.github.com/users/funtusov/repos","events_url":"https://api.github.com/users/funtusov/events{/privacy}","received_events_url":"https://api.github.com/users/funtusov/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/funtusov/ember-cli-form-data","description":"Ember CLI addon that adds FormData file uploads to Ember Data","fork":false,"url":"https://api.github.com/repos/funtusov/ember-cli-form-data","forks_url":"https://api.github.com/repos/funtusov/ember-cli-form-data/forks","keys_url":"https://api.github.com/repos/funtusov/ember-cli-form-data/keys{/key_id}","collaborators_url":"https://api.github.com/repos/funtusov/ember-cli-form-data/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/funtusov/ember-cli-form-data/teams","hooks_url":"https://api.github.com/repos/funtusov/ember-cli-form-data/hooks","issue_events_url":"https://api.github.com/repos/funtusov/ember-cli-form-data/issues/events{/number}","events_url":"https://api.github.com/repos/funtusov/ember-cli-form-data/events","assignees_url":"https://api.github.com/repos/funtusov/ember-cli-form-data/assignees{/user}","branches_url":"https://api.github.com/repos/funtusov/ember-cli-form-data/branches{/branch}","tags_url":"https://api.github.com/repos/funtusov/ember-cli-form-data/tags","blobs_url":"https://api.github.com/repos/funtusov/ember-cli-form-data/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/funtusov/ember-cli-form-data/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/funtusov/ember-cli-form-data/git/refs{/sha}","trees_url":"https://api.github.com/repos/funtusov/ember-cli-form-data/git/trees{/sha}","statuses_url":"https://api.github.com/repos/funtusov/ember-cli-form-data/statuses/{sha}","languages_url":"https://api.github.com/repos/funtusov/ember-cli-form-data/languages","stargazers_url":"https://api.github.com/repos/funtusov/ember-cli-form-data/stargazers","contributors_url":"https://api.github.com/repos/funtusov/ember-cli-form-data/contributors","subscribers_url":"https://api.github.com/repos/funtusov/ember-cli-form-data/subscribers","subscription_url":"https://api.github.com/repos/funtusov/ember-cli-form-data/subscription","commits_url":"https://api.github.com/repos/funtusov/ember-cli-form-data/commits{/sha}","git_commits_url":"https://api.github.com/repos/funtusov/ember-cli-form-data/git/commits{/sha}","comments_url":"https://api.github.com/repos/funtusov/ember-cli-form-data/comments{/number}","issue_comment_url":"https://api.github.com/repos/funtusov/ember-cli-form-data/issues/comments{/number}","contents_url":"https://api.github.com/repos/funtusov/ember-cli-form-data/contents/{+path}","compare_url":"https://api.github.com/repos/funtusov/ember-cli-form-data/compare/{base}...{head}","merges_url":"https://api.github.com/repos/funtusov/ember-cli-form-data/merges","archive_url":"https://api.github.com/repos/funtusov/ember-cli-form-data/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/funtusov/ember-cli-form-data/downloads","issues_url":"https://api.github.com/repos/funtusov/ember-cli-form-data/issues{/number}","pulls_url":"https://api.github.com/repos/funtusov/ember-cli-form-data/pulls{/number}","milestones_url":"https://api.github.com/repos/funtusov/ember-cli-form-data/milestones{/number}","notifications_url":"https://api.github.com/repos/funtusov/ember-cli-form-data/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/funtusov/ember-cli-form-data/labels{/name}","releases_url":"https://api.github.com/repos/funtusov/ember-cli-form-data/releases{/id}","created_at":"2015-01-25T15:44:49Z","updated_at":"2015-04-27T09:33:41Z","pushed_at":"2015-04-26T19:00:09Z","git_url":"git://github.com/funtusov/ember-cli-form-data.git","ssh_url":"git@github.com:funtusov/ember-cli-form-data.git","clone_url":"https://github.com/funtusov/ember-cli-form-data.git","svn_url":"https://github.com/funtusov/ember-cli-form-data","homepage":null,"size":258,"stargazers_count":17,"watchers_count":17,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":2,"forks":2,"open_issues":2,"watchers":17,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/funtusov/ember-cli-form-data/pulls/5"},"html":{"href":"https://github.com/funtusov/ember-cli-form-data/pull/5"},"issue":{"href":"https://api.github.com/repos/funtusov/ember-cli-form-data/issues/5"},"comments":{"href":"https://api.github.com/repos/funtusov/ember-cli-form-data/issues/5/comments"},"review_comments":{"href":"https://api.github.com/repos/funtusov/ember-cli-form-data/pulls/5/comments"},"review_comment":{"href":"https://api.github.com/repos/funtusov/ember-cli-form-data/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/funtusov/ember-cli-form-data/pulls/5/commits"},"statuses":{"href":"https://api.github.com/repos/funtusov/ember-cli-form-data/statuses/7090bb15c3030e05c9c311d8de69c01ca9abfa6e"}}}}