GORM Playground Link

https://github.com/go-gorm/playground/pull/412

Description

If you soft-delete a Has-One relationship, the deleted association won't be loaded if you use Preload(). If you use Joins(), though, it won't respect the soft deletion.

  var account Account{Number:"77"}
  DB.Create(&account)
  user := User{ Name: "jinzhu", Account: account}
  DB.Create(&user)

  DB.Delete(&account)

  // Works, no account in User
  DB.Preload("Account").First(&result, user.ID)

  // Doesn't work, account is hydrated even though it's been soft-deleted
  DB.Joins("Account").First(&result, user.ID)

Reopening #4918 since it was mistakenly closed.

Comment From: awmcclain

Duplicate of #4918