From 46d24b77a4e085fbb711af8e4707cf968853b463 Mon Sep 17 00:00:00 2001 From: Apurva Chitnis Date: Thu, 21 Feb 2019 11:19:00 +0000 Subject: [PATCH] consistent ordering of structs in Belongs To docs --- documents/associations.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/documents/associations.md b/documents/associations.md index bba6234e..595f1fef 100644 --- a/documents/associations.md +++ b/documents/associations.md @@ -6,17 +6,17 @@ ```go // `User` belongs to `Profile`, `ProfileID` is the foreign key +type Profile struct { + gorm.Model + Name string +} + type User struct { gorm.Model Profile Profile ProfileID int } -type Profile struct { - gorm.Model - Name string -} - db.Model(&user).Related(&profile) //// SELECT * FROM profiles WHERE id = 111; // 111 is user's foreign key ProfileID ```