{"action":"closed","issue":{"url":"https://api.github.com/repos/ga-wdi-boston/capstone-project/issues/153","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/153/labels{/name}","comments_url":"https://api.github.com/repos/ga-wdi-boston/capstone-project/issues/153/comments","events_url":"https://api.github.com/repos/ga-wdi-boston/capstone-project/issues/153/events","html_url":"https://github.com/ga-wdi-boston/capstone-project/issues/153","id":158573474,"number":153,"title":"Error thrown when one-to-one relationship added in Ember models","user":{"login":"olivia-leach","id":17397519,"avatar_url":"https://avatars.githubusercontent.com/u/17397519?v=3","gravatar_id":"","url":"https://api.github.com/users/olivia-leach","html_url":"https://github.com/olivia-leach","followers_url":"https://api.github.com/users/olivia-leach/followers","following_url":"https://api.github.com/users/olivia-leach/following{/other_user}","gists_url":"https://api.github.com/users/olivia-leach/gists{/gist_id}","starred_url":"https://api.github.com/users/olivia-leach/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/olivia-leach/subscriptions","organizations_url":"https://api.github.com/users/olivia-leach/orgs","repos_url":"https://api.github.com/users/olivia-leach/repos","events_url":"https://api.github.com/users/olivia-leach/events{/privacy}","received_events_url":"https://api.github.com/users/olivia-leach/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-06-05T20:42:38Z","updated_at":"2016-06-06T13:48:16Z","closed_at":"2016-06-06T13:48:16Z","body":"Hi there,\r\n\r\nI'm having issues setting up a one-to-one relationship for 2 of my models in Ember. Each 'building' has one 'baseline'. My models are set up as follows:\r\n\r\nBuilding model:\r\n```js\r\nimport Model from 'ember-data/model';\r\nimport attr from 'ember-data/attr';\r\nimport { belongsTo } from 'ember-data/relationships';\r\n\r\nexport default Model.extend({\r\n  name: attr('string'),\r\n  address: attr('string'),\r\n  city: attr('string'),\r\n  state: attr('string'),\r\n  zip: attr('string'),\r\n  lat: attr('number'),\r\n  long: attr('number'),\r\n  sq_ft: attr('number'),\r\n  year_const: attr('date'),\r\n  num_floors: attr('number'),\r\n  notes: attr('string'),\r\n  user: belongsTo('user'),\r\n  baseline: belongsTo('baseline')\r\n});\r\n```\r\n\r\nBaseline model:\r\n```js\r\nimport Model from 'ember-data/model';\r\nimport attr from 'ember-data/attr';\r\nimport { belongsTo } from 'ember-data/relationships';\r\n\r\nexport default Model.extend({\r\n  certified: attr('boolean'),\r\n  building: belongsTo('building'),\r\n});\r\n```\r\n\r\nThe relationship for buildings and users (```user: belongsTo('user')```) works fine, but when I add the ```baseline: belongsTo('baseline')``` line in the building model, I get the standard ```ember.debug.js:32096TypeError: Cannot read property 'some' of undefined``` in the chrome console.\r\n\r\nI know the API is returning the baseline data because if I change ```baseline: belongsTo('baseline')``` to ```baseline: attr()```, I can access the baseline object for a particular building (but I can't access any of the models below that, which I will have to do after I finish this part).\r\n\r\nWhen I go to localhost:3000/buildings/1, I see:\r\n\r\n```json\r\n{\r\n\"building\": {\r\n\"id\": 1,\r\n\"BID\": 5,\r\n\"name\": \"Crescent VII C\",\r\n\"address\": \"8390 East Crescent Parkway\",\r\n\"city\": \"Greenwood Village\",\r\n\"state\": \"CO\",\r\n\"zip\": \"80111\",\r\n\"lat\": 39.622378,\r\n\"long\": -104.890485,\r\n\"sq_ft\": 135332,\r\n\"year_const\": 1938,\r\n\"num_floors\": 6,\r\n\"notes\": \"One building, partly renovated to green\",\r\n\"user_id\": 1,\r\n\"baseline\": {\r\n\"id\": 1,\r\n\"certified\": false,\r\n\"building_id\": 1,\r\n\"created_at\": \"2016-06-05T17:45:15.381Z\",\r\n\"updated_at\": \"2016-06-05T17:45:15.381Z\"\r\n}\r\n}\r\n}\r\n```\r\n\r\nI also tried setting up this relationship with a hasMany/belongsTo relationship instead, just to see if that would work. I don't get an error in the console when I do that, but still the 'baseline' data isn't loading."}}
{"actor":{"display_login":"olivia-leach"}}