title: Unable to create foreign-key relationship with gorm where field name != type name
body: <p>I'm trying to create a "belongs-to" relationship in my application where the name of the field (and db column) is not the same as the type name. Gorm is complaining about this. Here is a short example that demonstrates the problem:</p>
  
  <pre><code>package main
  
  import (
      "fmt"
      "github.com/jinzhu/gorm"
      _ "github.com/mattn/go-sqlite3"
  )
  
  type Car struct {
      gorm.Model
      Owner   User
      OwnerID int
  }
  
  type User struct {
      gorm.Model
  }
  
  func main() {
      db, _ := gorm.Open("sqlite3", "test.db")
      defer db.Close()
      db.LogMode(true)
  
      db.CreateTable(&amp;Car{}, &amp;User{})
  
      u := User{}
      u.ID = 1
      db.Create(&amp;u)
  
      c := Car{}
      c.ID = 1
      c.Owner = u
      db.Create(&amp;c)
  
      cars := make([]Car, 5)
      db.Find(&amp;cars)
      for i := range cars {
          db.Model(cars[i]).Related(&amp;cars[i].Owner)
      }
  
      for i := range cars {
          fmt.Println(cars[i].Owner.ID)
      }
  }
  </code></pre>
  
  <p>We would expect this program to print out "1" as its last line, as this is the primary key of the Users relation that "owns" the only car in the database. Instead "0" is printed out, and verbose logging shows an error at the <code>Related(&amp;cars[i].Owner)</code> step:</p>
  
  <pre><code>(/home/nate/gocode/src/foo/main.go:26)
  [2016-04-09 19:33:46]  [122.35ms]  CREATE TABLE "cars" ("id" integer primary key autoincrement,"created_at" datetime,"updated_at" datetime,"deleted_at" datetime,"owner_id" integer )
  
  (/home/nate/gocode/src/foo/main.go:26)
  [2016-04-09 19:33:46]  [98.96ms]  CREATE INDEX idx_cars_deleted_at ON "cars"(deleted_at)
  
  (/home/nate/gocode/src/foo/main.go:26)
  [2016-04-09 19:33:46]  [108.95ms]  CREATE TABLE "users" ("id" integer primary key autoincrement,"created_at" datetime,"updated_at" datetime,"deleted_at" datetime )
  
  (/home/nate/gocode/src/foo/main.go:26)
  [2016-04-09 19:33:46]  [125.74ms]  CREATE INDEX idx_users_deleted_at ON "users"(deleted_at)
  
  (/home/nate/gocode/src/foo/main.go:30)
  [2016-04-09 19:33:46]  [0.53ms]  INSERT INTO "users" ("id","created_at","updated_at","deleted_at") VALUES ('1','2016-04-09T19:33:46-04:00','2016-04-09T19:33:46-04:00','&lt;nil&gt;')
  
  (/home/nate/gocode/src/foo/main.go:35)
  [2016-04-09 19:33:46]  [1.98ms]  UPDATE "users" SET "created_at" = '2016-04-09T19:33:46-04:00', "updated_at" = '2016-04-09T19:33:46-04:00', "deleted_at" = '&lt;nil&gt;'  WHERE "users".deleted_at IS NULL AND "users"."id" = '1'
  
  (/home/nate/gocode/src/foo/main.go:35)
  [2016-04-09 19:33:46]  [0.43ms]  INSERT INTO "cars" ("id","created_at","updated_at","deleted_at","owner_id") VALUES ('1','2016-04-09T19:33:46-04:00','2016-04-09T19:33:46-04:00','&lt;nil&gt;','1')
  
  (/home/nate/gocode/src/foo/main.go:38)
  [2016-04-09 19:33:46]  [0.64ms]  SELECT * FROM "cars"  WHERE "cars".deleted_at IS NULL
  
  (/home/nate/gocode/src/foo/main.go:40)
  [2016-04-09 19:33:46]  invalid association []
  0
  </code></pre>
  
  <p>What is going on here? Is there some special tag that I have to use on the <code>Owner</code> field? I've tried using <code>gorm:"ForeignKey:owner_id"</code> and <code>gorm:"AssociationForeignKey:owner_id"</code>, both giving the same result.</p>