{"action":"created","issue":{"url":"https://api.github.com/repos/ga-wdi-boston/capstone-project/issues/301","repository_url":"https://api.github.com/repos/ga-wdi-boston/capstone-project","labels_url":"https://api.github.com/repos/ga-wdi-boston/capstone-project/issues/301/labels{/name}","comments_url":"https://api.github.com/repos/ga-wdi-boston/capstone-project/issues/301/comments","events_url":"https://api.github.com/repos/ga-wdi-boston/capstone-project/issues/301/events","html_url":"https://github.com/ga-wdi-boston/capstone-project/issues/301","id":187796876,"number":301,"title":"[Ember] Uploads service is undefined","user":{"login":"styletabtech","id":20650779,"avatar_url":"https://avatars.githubusercontent.com/u/20650779?v=3","gravatar_id":"","url":"https://api.github.com/users/styletabtech","html_url":"https://github.com/styletabtech","followers_url":"https://api.github.com/users/styletabtech/followers","following_url":"https://api.github.com/users/styletabtech/following{/other_user}","gists_url":"https://api.github.com/users/styletabtech/gists{/gist_id}","starred_url":"https://api.github.com/users/styletabtech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/styletabtech/subscriptions","organizations_url":"https://api.github.com/users/styletabtech/orgs","repos_url":"https://api.github.com/users/styletabtech/repos","events_url":"https://api.github.com/users/styletabtech/events{/privacy}","received_events_url":"https://api.github.com/users/styletabtech/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":11,"created_at":"2016-11-07T18:56:01Z","updated_at":"2016-11-08T04:03:04Z","closed_at":"2016-11-07T22:40:12Z","body":"Hey @berziiii I'm working on creating a file upload via your [instructions](https://github.com/ga-wdi-boston/capstone-project/issues/287) (super easy to follow btw thank you!!) and I've run into an issue where 'uploads' is undefined in the route of my new-photo\r\n\r\nnew-photo/route.js\r\n```\r\nexport default Ember.Route.extend({\r\n\r\n  actions: {\r\n    createPhoto(newPhoto) {\r\n        console.log('newPhoto is', newPhoto); \r\n        console.log(this.get('uploads'));\r\n        return this.get('uploads').newPhotoUpload(newPhoto) // this is where uploads is undefined\r\n       .then(() => this.transitionTo('photos'))\r\n       .catch((error) => console.error(error));\r\n    },\r\n  },\r\n});\r\n```\r\nI'm not sure if I need to inject this service in a particular way? I've tried doing so in the above file but Ember said no. I'm a little lost on how to go about debugging past this point now that I've identified the problem. \r\n\r\nHere's the rest of my code:\r\n\r\n**new-photo-form/template:** \r\n```\r\n<form enctype=\"multipart/form-data\" id=\"new-photo-form\" {{ action 'create' on='submit' }}>\r\n  <fieldset>\r\n    <legend>Add A Photo</legend>\r\n    <input type=\"text\" class=\"form-control\" name=\"photo[file_name]\" placeholder=\"Image Name\">\r\n    <input type=\"file\" name=\"photo[photo_upload]\" value=\"Upload Photo\">\r\n    <input type=\"submit\" class=\"btn btn-success\" name=\"submit\" value=\"Add Photo\">\r\n  </fieldset>\r\n</form>\r\n```\r\n**new-photo-form/component:** \r\n```\r\nexport default Ember.Component.extend({\r\n  newPhoto: {}, // New photo object being constructed from the form\r\n\r\n  actions: {\r\n    create() {\r\n      let newPhoto = new FormData(Ember.$('#new-photo-form')); // Ember jQuery to find the form by it's id.\r\n      this.sendAction('create', newPhoto); // Grabs the newPhoto object which has been converted into FormData and sends it up to the route template\r\n      this.set('newPhoto', null); // Resets the newPhoto Object\r\n    }\r\n  }\r\n});\r\n```\r\n\r\n**new-photo/template** \r\n```\r\n{{new-photo-form create='createPhoto'}}\r\n```\r\n\r\n**photo/uploads/service.js:** \r\n```\r\nexport default Ember.Service.extend({\r\n  ajax: Ember.inject.service(),\r\n\r\n    newPhotoUpload (newPhoto) {\r\n      return this.get('ajax').post('/photos', {  \r\n        data: newPhoto, // The FormData object which we have called `newPhoto`\r\n        contentType: false,\r\n        processData: false,\r\n      });\r\n     },\r\n});\r\n```"},"comment":{"url":"https://api.github.com/repos/ga-wdi-boston/capstone-project/issues/comments/259040111","html_url":"https://github.com/ga-wdi-boston/capstone-project/issues/301#issuecomment-259040111","issue_url":"https://api.github.com/repos/ga-wdi-boston/capstone-project/issues/301","id":259040111,"user":{"login":"styletabtech","id":20650779,"avatar_url":"https://avatars.githubusercontent.com/u/20650779?v=3","gravatar_id":"","url":"https://api.github.com/users/styletabtech","html_url":"https://github.com/styletabtech","followers_url":"https://api.github.com/users/styletabtech/followers","following_url":"https://api.github.com/users/styletabtech/following{/other_user}","gists_url":"https://api.github.com/users/styletabtech/gists{/gist_id}","starred_url":"https://api.github.com/users/styletabtech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/styletabtech/subscriptions","organizations_url":"https://api.github.com/users/styletabtech/orgs","repos_url":"https://api.github.com/users/styletabtech/repos","events_url":"https://api.github.com/users/styletabtech/events{/privacy}","received_events_url":"https://api.github.com/users/styletabtech/received_events","type":"User","site_admin":false},"created_at":"2016-11-08T04:03:04Z","updated_at":"2016-11-08T04:03:04Z","body":"hi @jrhorn424 I edited my last comment to 'new-photo-form' for clarity, that was a typo on my part. Thanks for the further explanation on Ember jQuery!"}}
{"actor":{"display_login":"styletabtech"}}