Skip to content

Commit

Permalink
Changes as per code review
Browse files Browse the repository at this point in the history
  • Loading branch information
0xTim authored and loganwright committed Feb 24, 2017
1 parent 683390b commit 379b952
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Sources/Fluent/Relations/Children.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ extension Children: QueryRepresentable {
throw RelationError.noIdentifier
}

let foreignId = foreignKey ?? "\(type(of: parent))_\(T.idKey)".lowercased()
let foreignId = foreignKey ?? "\(type(of: parent).name)_\(T.idKey)".lowercased()
return try T.query().filter(foreignId, ident)
}
}
Expand Down
8 changes: 4 additions & 4 deletions Tests/FluentTests/ChildTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ class Owner: Entity {
}

static func prepare(_ database: Fluent.Database) throws {
try database.create("Owners") { pet in
try database.create(entity) { pet in
pet.id()
pet.string("name")
}
}
static func revert(_ database: Fluent.Database) throws {
try database.delete("Pets")
try database.delete(Owner.entity)
}

func makeNode(context: Context) throws -> Node {
Expand Down Expand Up @@ -86,14 +86,14 @@ class Pet: Entity {
}

static func prepare(_ database: Fluent.Database) throws {
try database.create("Pets") { pet in
try database.create(entity) { pet in
pet.id()
pet.string("name")
pet.parent(Owner.self, optional: false)
}
}
static func revert(_ database: Fluent.Database) throws {
try database.delete("Pets")
try database.delete(Pet.entity)
}

func makeNode(context: Context) throws -> Node {
Expand Down

0 comments on commit 379b952

Please sign in to comment.