Skip to content

Commit

Permalink
Merge pull request #171 from vapor/null-0-id
Browse files Browse the repository at this point in the history
ignore null or 0 id results
  • Loading branch information
tanner0101 authored Feb 7, 2017
2 parents 5fddaf9 + a9f79ff commit cb23e84
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Sources/Fluent/Query/Query.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit cb23e84

Please sign in to comment.