{"action":"created","issue":{"url":"https://api.github.com/repos/mphasize/sails-generate-ember-blueprints/issues/31","labels_url":"https://api.github.com/repos/mphasize/sails-generate-ember-blueprints/issues/31/labels{/name}","comments_url":"https://api.github.com/repos/mphasize/sails-generate-ember-blueprints/issues/31/comments","events_url":"https://api.github.com/repos/mphasize/sails-generate-ember-blueprints/issues/31/events","html_url":"https://github.com/mphasize/sails-generate-ember-blueprints/issues/31","id":65716074,"number":31,"title":"Single record responses have pluralized key","user":{"login":"timohofmeijer","id":1086519,"avatar_url":"https://avatars.githubusercontent.com/u/1086519?v=3","gravatar_id":"","url":"https://api.github.com/users/timohofmeijer","html_url":"https://github.com/timohofmeijer","followers_url":"https://api.github.com/users/timohofmeijer/followers","following_url":"https://api.github.com/users/timohofmeijer/following{/other_user}","gists_url":"https://api.github.com/users/timohofmeijer/gists{/gist_id}","starred_url":"https://api.github.com/users/timohofmeijer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timohofmeijer/subscriptions","organizations_url":"https://api.github.com/users/timohofmeijer/orgs","repos_url":"https://api.github.com/users/timohofmeijer/repos","events_url":"https://api.github.com/users/timohofmeijer/events{/privacy}","received_events_url":"https://api.github.com/users/timohofmeijer/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-04-01T15:48:49Z","updated_at":"2015-04-01T19:17:44Z","closed_at":null,"body":"The response for `/users/123` is currently:\r\n```\r\n{\r\n  \"users\": [\r\n    {\r\n      \"key\": \"value\"\r\n    }\r\n  ]\r\n}\r\n```\r\nwhile Ember seems to be expecting:\r\n```\r\n{\r\n  \"user\": {\r\n      \"key\": \"value\"\r\n  }\r\n}\r\n```\r\n\r\nMy setup (ember-cli 0.2.2 / ember 1.11.0 / ember-data 1.0.0-beta.16.1 / sails 0.11 / sails-generate-ember-blueprints 0.0.6) crapped out when requesting a single record saying:\r\n```\r\nExpected an object as `data` in a call to `push` for ...\r\n```\r\n\r\nI fixed it changing the Ember service like so:\r\n```\r\n// line 29 in sevices/Ember.js\r\n\r\n// many or just one?\r\nif ( plural ) {\r\n\tjson[ documentIdentifier ] = [];\r\n\t_.each( records, function ( record ) {\r\n\t\tjson[ documentIdentifier ] = json[ documentIdentifier ].concat( prepareOneRecord( record ) );\r\n\t} );\r\n} else {\r\n\tjson[ emberModelIdentity ] = prepareOneRecord( records );\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/mphasize/sails-generate-ember-blueprints/issues/comments/88599302","html_url":"https://github.com/mphasize/sails-generate-ember-blueprints/issues/31#issuecomment-88599302","issue_url":"https://api.github.com/repos/mphasize/sails-generate-ember-blueprints/issues/31","id":88599302,"user":{"login":"timohofmeijer","id":1086519,"avatar_url":"https://avatars.githubusercontent.com/u/1086519?v=3","gravatar_id":"","url":"https://api.github.com/users/timohofmeijer","html_url":"https://github.com/timohofmeijer","followers_url":"https://api.github.com/users/timohofmeijer/followers","following_url":"https://api.github.com/users/timohofmeijer/following{/other_user}","gists_url":"https://api.github.com/users/timohofmeijer/gists{/gist_id}","starred_url":"https://api.github.com/users/timohofmeijer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timohofmeijer/subscriptions","organizations_url":"https://api.github.com/users/timohofmeijer/orgs","repos_url":"https://api.github.com/users/timohofmeijer/repos","events_url":"https://api.github.com/users/timohofmeijer/events{/privacy}","received_events_url":"https://api.github.com/users/timohofmeijer/received_events","type":"User","site_admin":false},"created_at":"2015-04-01T19:17:43Z","updated_at":"2015-04-01T19:17:43Z","body":"@bmac nope, I’m trying to fetch data using username_slug, \r\nso:\r\n```\r\n/users/bla\r\n```\r\nresponds with:\r\n```\r\n{\r\n  \"users\": [{\r\n      \"id\": 123,\r\n      \"username\": \"bla\",\r\n    }]\r\n}\r\n```\r\n(I was just disabling slugs here and seem to get less errors)"}}