{"action":"created","issue":{"url":"https://api.github.com/repos/lotus/model/issues/206","labels_url":"https://api.github.com/repos/lotus/model/issues/206/labels{/name}","comments_url":"https://api.github.com/repos/lotus/model/issues/206/comments","events_url":"https://api.github.com/repos/lotus/model/issues/206/events","html_url":"https://github.com/lotus/model/issues/206","id":94282452,"number":206,"title":"id not assigned to the entity on create","user":{"login":"pascalbetz","id":16653,"avatar_url":"https://avatars.githubusercontent.com/u/16653?v=3","gravatar_id":"","url":"https://api.github.com/users/pascalbetz","html_url":"https://github.com/pascalbetz","followers_url":"https://api.github.com/users/pascalbetz/followers","following_url":"https://api.github.com/users/pascalbetz/following{/other_user}","gists_url":"https://api.github.com/users/pascalbetz/gists{/gist_id}","starred_url":"https://api.github.com/users/pascalbetz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pascalbetz/subscriptions","organizations_url":"https://api.github.com/users/pascalbetz/orgs","repos_url":"https://api.github.com/users/pascalbetz/repos","events_url":"https://api.github.com/users/pascalbetz/events{/privacy}","received_events_url":"https://api.github.com/users/pascalbetz/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-07-10T10:45:59Z","updated_at":"2015-07-10T11:03:55Z","closed_at":null,"body":"According to the documentation in Repository:\r\n```\r\n...\r\nArticleRepository.create(article) # creates a record\r\n#   article.id # => 23\r\n```\r\nthe ID (primary key for RDBMS) should get assigned upon create which is not the case.\r\nFailing Testcase here: https://github.com/pascalbetz/lotus-model/commit/c5e5150f811e84290cd7d03e12e77f88cdc8b5a6\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/lotus/model/issues/comments/120385968","html_url":"https://github.com/lotus/model/issues/206#issuecomment-120385968","issue_url":"https://api.github.com/repos/lotus/model/issues/206","id":120385968,"user":{"login":"pascalbetz","id":16653,"avatar_url":"https://avatars.githubusercontent.com/u/16653?v=3","gravatar_id":"","url":"https://api.github.com/users/pascalbetz","html_url":"https://github.com/pascalbetz","followers_url":"https://api.github.com/users/pascalbetz/followers","following_url":"https://api.github.com/users/pascalbetz/following{/other_user}","gists_url":"https://api.github.com/users/pascalbetz/gists{/gist_id}","starred_url":"https://api.github.com/users/pascalbetz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pascalbetz/subscriptions","organizations_url":"https://api.github.com/users/pascalbetz/orgs","repos_url":"https://api.github.com/users/pascalbetz/repos","events_url":"https://api.github.com/users/pascalbetz/events{/privacy}","received_events_url":"https://api.github.com/users/pascalbetz/received_events","type":"User","site_admin":false},"created_at":"2015-07-10T11:03:55Z","updated_at":"2015-07-10T11:03:55Z","body":"@jodosha so you don't want to modify the entity passed in as argument?\r\n\r\nSomething like this will fail:\r\n```\r\nuser = User.new(...)\r\nUserRepository.create(user)\r\narticle = Article.new(user_id: user.id) # failure here: user.id is nil\r\nArticleRepositry.create(article)\r\n```\r\nbut i would actually expect it to work (i only looked up the documentation after i realized my code is not working)\r\n\r\nThis would lead to something like\r\n```\r\narticle = Article.new(...)\r\narticle = ArticleRepositry.create(article)\r\n...\r\n```\r\nwhenever you need to have the id (i.e. when you associate records). Looks error prone and superfluous to me. Care to explain the idea a bit more?\r\n\r\n"}}