Your Question
am trying to preload todos while only selecting username from the user doing this query:
type User struct {
gorm.Model
Username string
Name string
Todos []Todo
}
users := new([]User)
db.Preload("Todos").Select("username").Find(users)
am only getting the username and not the Todos, am not sure if this is a bug or the intended behavior for gorm.
The document you expected this should be explained
Expected answer
I expect the way to get the preload Todos while still only selecting Username.
Comment From: oSethoum
I had to select the foreign key of the relation, it works like expected, am closing this issue.