From 9a63fb28bad5cfdb0f89e918ad063f45285f1064 Mon Sep 17 00:00:00 2001 From: Jinzhu Date: Sat, 26 Dec 2015 20:46:25 +0800 Subject: [PATCH] Update README --- README.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index e475decd..ddbd6b2e 100644 --- a/README.md +++ b/README.md @@ -661,12 +661,11 @@ Association Mode contains some helper methods to handle relationship things easi ```go // Start Association Mode -db.Model(&source).Association(fieldNameOfRelationship) - +var user User db.Model(&user).Association("Languages") -// source (user) need to have a valid primary key -// fieldNameOfRelationship ("Languages") need to be a valid relationship of source -// If not, it will return error, check it with: +// `user` is the source, it need to be a valid record (contains primary key) +// `Languages` is source's field name for a relationship. +// If those conditions not matched, will return an error, check it with: // db.Model(&user).Association("Languages").Error