From 1602a37d08dcfa4ac8c1de3d675bfe4aaa4662e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Sun, 26 May 2019 06:22:28 +0200 Subject: [PATCH] Small improvement --- Documentation/GoodPracticesForDesigningRecordTypes.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Documentation/GoodPracticesForDesigningRecordTypes.md b/Documentation/GoodPracticesForDesigningRecordTypes.md index 549188fed..b74bee113 100644 --- a/Documentation/GoodPracticesForDesigningRecordTypes.md +++ b/Documentation/GoodPracticesForDesigningRecordTypes.md @@ -461,9 +461,7 @@ class NaiveLibraryManager { func books(writtenBy author: Author) -> [Book] { do { return try dbQueue.read { db in - try Book - .filter(Book.Columns.authorId == author.id) - .fetchAll(db) + try author.books.fetchAll(db) } } catch { return [] @@ -514,7 +512,7 @@ class ImprovedLibraryManager { func books(writtenBy author: Author) throws -> [Book] { return try dbQueue.read { db in - try Book.filter(Book.Columns.authorId == author.id).fetchAll(db) + try author.books.fetchAll(db) } } }