{"action":"created","issue":{"url":"https://api.github.com/repos/adonisjs/adonis-lucid/issues/14","labels_url":"https://api.github.com/repos/adonisjs/adonis-lucid/issues/14/labels{/name}","comments_url":"https://api.github.com/repos/adonisjs/adonis-lucid/issues/14/comments","events_url":"https://api.github.com/repos/adonisjs/adonis-lucid/issues/14/events","html_url":"https://github.com/adonisjs/adonis-lucid/issues/14","id":126516608,"number":14,"title":"Issues with relations","user":{"login":"domdeger","id":7481602,"avatar_url":"https://avatars.githubusercontent.com/u/7481602?v=3","gravatar_id":"","url":"https://api.github.com/users/domdeger","html_url":"https://github.com/domdeger","followers_url":"https://api.github.com/users/domdeger/followers","following_url":"https://api.github.com/users/domdeger/following{/other_user}","gists_url":"https://api.github.com/users/domdeger/gists{/gist_id}","starred_url":"https://api.github.com/users/domdeger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/domdeger/subscriptions","organizations_url":"https://api.github.com/users/domdeger/orgs","repos_url":"https://api.github.com/users/domdeger/repos","events_url":"https://api.github.com/users/domdeger/events{/privacy}","received_events_url":"https://api.github.com/users/domdeger/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"thetutlage","id":1706381,"avatar_url":"https://avatars.githubusercontent.com/u/1706381?v=3","gravatar_id":"","url":"https://api.github.com/users/thetutlage","html_url":"https://github.com/thetutlage","followers_url":"https://api.github.com/users/thetutlage/followers","following_url":"https://api.github.com/users/thetutlage/following{/other_user}","gists_url":"https://api.github.com/users/thetutlage/gists{/gist_id}","starred_url":"https://api.github.com/users/thetutlage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thetutlage/subscriptions","organizations_url":"https://api.github.com/users/thetutlage/orgs","repos_url":"https://api.github.com/users/thetutlage/repos","events_url":"https://api.github.com/users/thetutlage/events{/privacy}","received_events_url":"https://api.github.com/users/thetutlage/received_events","type":"User","site_admin":false},"milestone":null,"comments":11,"created_at":"2016-01-13T21:16:57Z","updated_at":"2016-02-01T17:55:34Z","closed_at":null,"body":"Hello, \r\n\r\nI have a Model, which i want to create and then create a related item of this model. The funny part is, that the creation of both items works, but they are not associated. Here are my models.\r\n\r\nCustomer:\r\n``` javascript\r\n'use strict'\r\n\r\n const Lucid = use(\"Lucid\")\r\n\r\n class Customer extends Lucid {\r\n\r\n  static get table () {\r\n    return \"customer\"\r\n  }\r\n\r\n  static get softDeletes () {\r\n    return false\r\n  }\r\n\r\n  static get timestamps () {\r\n    return false;\r\n  }\r\n\r\n  static get primaryKey () {\r\n    return 'CustomerId'\r\n  }\r\n\r\n  address () {\r\n    return this.hasOne('App/Model/Address', 'AddressId','AddressId');\r\n  }\r\n}\r\nmodule.exports = Customer\r\n\r\n```\r\nAddress:\r\n\r\n``` javascript\r\n'use strict'\r\n\r\nconst Lucid = use(\"Lucid\")\r\n\r\nclass Address extends Lucid {\r\n\r\n  static get table () {\r\n    return \"address\";\r\n  }\r\n\r\n  static get softDeletes () {\r\n    return false\r\n  }\r\n\r\n  static get primaryKey () {\r\n    return 'AddressId'\r\n  }\r\n\r\n  static get timestamps () {\r\n    return false;\r\n  }\r\n\r\n  customer () {\r\n    return this.belongsTo('App/Model/Customer', 'AddressId', 'AddressId');\r\n   }\r\n\r\n  position () {\r\n    return this.hasOne('App/Model/Position','PositionId', 'PositionId');\r\n  }\r\n}\r\n\r\nmodule.exports = Address\r\n``` \r\n\r\nController-Code\r\n\r\n``` javascript\r\nlet input = request.all();\r\nconst customer = new Customer();\r\ncustomer.DeliveryFrom = input.DeliveryFrom;\r\ncustomer.DeliveryTo = input.DeliveryTo;\r\ncustomer.HasRamp = input.HasRamp;\r\ncustomer.HasStapler = input.HasStapler;\r\ncustomer.HasTrailer = input.HasTrailer;\r\ncustomer.Name = input.Name;\r\ncustomer.Notices = input.Notices;\r\n\r\nyield customer.create();\r\nyield customer.address().create({\r\n  City: input.Address.City,\r\n  Country: input.Address.Country,\r\n  Number: input.Address.Number,\r\n  Street: input.Address.Street\r\n});\r\n\r\nyield customer.address().position().create({\r\n  Latitude: input.Address.Position.latitude,\r\n  Longitude: input.Address.Position.longitude\r\n});\r\n  \r\nresponse.status(200).send();\r\n\r\n```"},"comment":{"url":"https://api.github.com/repos/adonisjs/adonis-lucid/issues/comments/178095385","html_url":"https://github.com/adonisjs/adonis-lucid/issues/14#issuecomment-178095385","issue_url":"https://api.github.com/repos/adonisjs/adonis-lucid/issues/14","id":178095385,"user":{"login":"thetutlage","id":1706381,"avatar_url":"https://avatars.githubusercontent.com/u/1706381?v=3","gravatar_id":"","url":"https://api.github.com/users/thetutlage","html_url":"https://github.com/thetutlage","followers_url":"https://api.github.com/users/thetutlage/followers","following_url":"https://api.github.com/users/thetutlage/following{/other_user}","gists_url":"https://api.github.com/users/thetutlage/gists{/gist_id}","starred_url":"https://api.github.com/users/thetutlage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thetutlage/subscriptions","organizations_url":"https://api.github.com/users/thetutlage/orgs","repos_url":"https://api.github.com/users/thetutlage/repos","events_url":"https://api.github.com/users/thetutlage/events{/privacy}","received_events_url":"https://api.github.com/users/thetutlage/received_events","type":"User","site_admin":false},"created_at":"2016-02-01T17:55:33Z","updated_at":"2016-02-01T17:55:33Z","body":"@domdeger You can insert nested relations so far, i think it will be part of Lucid in next release."}}