Skip to content

Commit

Permalink
Add missing validate() in create(). (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
mjmsmith authored and antonmes committed Jun 10, 2016
1 parent c13d6b7 commit 32112de
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Sources/SQL/Model/Model.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 32112de

Please sign in to comment.