Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for Toy (0.23 sec)

  1. tests/associations_has_one_test.go

    	// Append
    	toy := Toy{Name: "toy-has-one-append"}
    
    	if err := DB.Model(&pet2).Association("Toy").Append(&toy); err != nil {
    		t.Fatalf("Error happened when append toy, got %v", err)
    	}
    
    	if toy.ID == 0 {
    		t.Fatalf("Toy's ID should be created")
    	}
    
    	pet.Toy = toy
    	CheckPet(t, pet2, pet)
    
    	AssertAssociationCount(t, pet, "Toy", 1, "AfterAppend")
    
    	// Replace
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 6.8K bytes
    - Viewed (0)
Back to top