Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for TestPolymorphicHasOneAssociationForSlice (0.36 sec)

  1. tests/associations_has_one_test.go

    	if err := DB.Model(&pet2).Association("Toy").Clear(); err != nil {
    		t.Errorf("Error happened when clear Toy, got %v", err)
    	}
    
    	AssertAssociationCount(t, pet2, "Toy", 0, "after clear")
    }
    
    func TestPolymorphicHasOneAssociationForSlice(t *testing.T) {
    	pets := []Pet{
    		{Name: "hasone-1", Toy: Toy{Name: "toy-has-one"}},
    		{Name: "hasone-2", Toy: Toy{}},
    		{Name: "hasone-3", Toy: Toy{Name: "toy-has-one"}},
    	}
    
    	DB.Create(&pets)
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 6.8K bytes
    - Viewed (0)
Back to top