From a9f79ffa5b8a0ef9e489f79d1db50d40f0b78a18 Mon Sep 17 00:00:00 2001 From: Tanner Nelson Date: Tue, 7 Feb 2017 13:18:13 +0100 Subject: [PATCH] ignore null or 0 id results --- Sources/Fluent/Query/Query.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Sources/Fluent/Query/Query.swift b/Sources/Fluent/Query/Query.swift index dcbf1aad..f4107d61 100644 --- a/Sources/Fluent/Query/Query.swift +++ b/Sources/Fluent/Query/Query.swift @@ -211,7 +211,10 @@ extension QueryRepresentable { } else { model.willCreate() let node = try model.makeNode(context: query._context) - model.id = try query.create(node) + let id = try query.create(node) + if id != nil, id != .null, id != 0 { + model.id = id + } model.didCreate() } model.exists = true