Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for Hammond (0.06 sec)

  1. tests/named_polymorphic_test.go

    	OtherToy     Toy `gorm:"polymorphic:Owner;polymorphicValue:hamster_other"`
    }
    
    func TestNamedPolymorphic(t *testing.T) {
    	DB.Migrator().DropTable(&Hamster{})
    	DB.AutoMigrate(&Hamster{})
    
    	hamster := Hamster{Name: "Mr. Hammond", PreferredToy: Toy{Name: "bike"}, OtherToy: Toy{Name: "treadmill"}}
    	DB.Save(&hamster)
    
    	hamster2 := Hamster{}
    	DB.Preload("PreferredToy").Preload("OtherToy").Find(&hamster2, hamster.Id)
    
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Wed Jul 08 09:59:40 UTC 2020
    - 4.2K bytes
    - Viewed (0)
Back to top