In my old Vapor 3 code I'm creating models like this:
address.create(on: conn).flatMap { savedAddress in
// do something with saved address
}
With the help of the Vapor 4 documentation I'm now passing db to the create function instead of a connection. The issue is, that it seems that flatMap returns Void as I'm getting the following error when I try to access savedAddress: "Value of tuple type 'Void' has no member ...".
How should I rewrite this?
iMike#3049
and I'll help you with migration to Vapor 4 – imikeVoid
on new record creation the workaround is to set id to new record in advance and then retrieve that record from the database by thatid
. – imike