From 32112de05478e558c7681c504efeb9c0747b1a74 Mon Sep 17 00:00:00 2001 From: Mark Smith Date: Fri, 10 Jun 2016 15:58:25 -0400 Subject: [PATCH] Add missing validate() in create(). (#11) --- Sources/SQL/Model/Model.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Sources/SQL/Model/Model.swift b/Sources/SQL/Model/Model.swift index 41f4f19..7854b62 100644 --- a/Sources/SQL/Model/Model.swift +++ b/Sources/SQL/Model/Model.swift @@ -345,6 +345,8 @@ public extension Model { throw ModelError(description: "Cannot create an already persisted model.") } + try validate() + let pk: PrimaryKey = try connection.executeInsertQuery(query: self.dynamicType.insertQuery(values: persistedValuesByField), returningPrimaryKeyForField: self.dynamicType.declaredPrimaryKeyField) guard let newSelf = try self.dynamicType.get(pk, connection: connection) else {