{"action":"created","issue":{"url":"https://api.github.com/repos/samselikoff/ember-cli-mirage/issues/560","repository_url":"https://api.github.com/repos/samselikoff/ember-cli-mirage","labels_url":"https://api.github.com/repos/samselikoff/ember-cli-mirage/issues/560/labels{/name}","comments_url":"https://api.github.com/repos/samselikoff/ember-cli-mirage/issues/560/comments","events_url":"https://api.github.com/repos/samselikoff/ember-cli-mirage/issues/560/events","html_url":"https://github.com/samselikoff/ember-cli-mirage/issues/560","id":132697686,"number":560,"title":"[Doc] seeding database when using Models","user":{"login":"jelhan","id":4965703,"avatar_url":"https://avatars.githubusercontent.com/u/4965703?v=3","gravatar_id":"","url":"https://api.github.com/users/jelhan","html_url":"https://github.com/jelhan","followers_url":"https://api.github.com/users/jelhan/followers","following_url":"https://api.github.com/users/jelhan/following{/other_user}","gists_url":"https://api.github.com/users/jelhan/gists{/gist_id}","starred_url":"https://api.github.com/users/jelhan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jelhan/subscriptions","organizations_url":"https://api.github.com/users/jelhan/orgs","repos_url":"https://api.github.com/users/jelhan/repos","events_url":"https://api.github.com/users/jelhan/events{/privacy}","received_events_url":"https://api.github.com/users/jelhan/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-02-10T13:17:12Z","updated_at":"2016-02-10T13:58:26Z","closed_at":null,"body":"I'm running 0.2.0-beta.3. I've defined models since I need support for relationships. Seems to work fine. But I haven't any clue how to seed the database. If I'm running `server.create('my-model');` I'm getting an error that I must define a factory. But can't find any information in docs how models and factories play together."},"comment":{"url":"https://api.github.com/repos/samselikoff/ember-cli-mirage/issues/comments/182386947","html_url":"https://github.com/samselikoff/ember-cli-mirage/issues/560#issuecomment-182386947","issue_url":"https://api.github.com/repos/samselikoff/ember-cli-mirage/issues/560","id":182386947,"user":{"login":"jelhan","id":4965703,"avatar_url":"https://avatars.githubusercontent.com/u/4965703?v=3","gravatar_id":"","url":"https://api.github.com/users/jelhan","html_url":"https://github.com/jelhan","followers_url":"https://api.github.com/users/jelhan/followers","following_url":"https://api.github.com/users/jelhan/following{/other_user}","gists_url":"https://api.github.com/users/jelhan/gists{/gist_id}","starred_url":"https://api.github.com/users/jelhan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jelhan/subscriptions","organizations_url":"https://api.github.com/users/jelhan/orgs","repos_url":"https://api.github.com/users/jelhan/repos","events_url":"https://api.github.com/users/jelhan/events{/privacy}","received_events_url":"https://api.github.com/users/jelhan/received_events","type":"User","site_admin":false},"created_at":"2016-02-10T13:58:26Z","updated_at":"2016-02-10T13:58:26Z","body":"I was to fast by closing. I thought it's the same as described for [schemas](http://www.ember-cli-mirage.com/docs/v0.2.0-beta.3/quickstart/#associations-and-serializers) but object returned by `server.create('factory-name');` hasn't a create function for relationships.\r\n\r\nI thought it's like this:\r\n```\r\n// mirage/models/author.js\r\nimport { Model, hasMany } from 'ember-cli-mirage';\r\n\r\nexport default Model.extend({\r\n  blogPosts: hasMany()\r\n});\r\n\r\n// mirage/models/blog-post.js\r\nimport { Model } from 'ember-cli-mirage';\r\n\r\nexport default Model;\r\n\r\n// mirage/factory/author.js\r\nport { Factory } from 'ember-cli-mirage';\r\n\r\nexport default Factory.extend({\r\n  name(i) {\r\n    return `author ${i}`;\r\n  }\r\n});\r\n\r\n// mirage/factory/blog-post.js\r\nport { Factory } from 'ember-cli-mirage';\r\n\r\nexport default Factory.extend({\r\n  title(i) {\r\n    return `title ${i}`;\r\n  }\r\n});\r\n\r\n// acceptance test\r\nconst author = server.create('author');\r\nautor.createBlogPost();\r\n```"}}