Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for TestPolymorphicHasOneAssociationForSlice (0.17 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)
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Wed Jun 12 10:49:45 UTC 2024
    - 7.1K bytes
    - Viewed (0)
Back to top