diff --git a/callback_query.go b/callback_query.go index f46d6ad4..81b191e7 100644 --- a/callback_query.go +++ b/callback_query.go @@ -76,7 +76,7 @@ func Query(scope *Scope) { } } - if !anyRecordFound { + if !anyRecordFound && !isSlice { scope.Err(RecordNotFound) } } diff --git a/query_test.go b/query_test.go index 09b6c702..a7e3c325 100644 --- a/query_test.go +++ b/query_test.go @@ -146,8 +146,8 @@ func TestSearchWithPlainSQL(t *testing.T) { t.Errorf("Should found 1 users, but got %v", len(users)) } - if !DB.Where("name = ?", "none existing").Find(&[]User{}).RecordNotFound() { - t.Errorf("Should get RecordNotFound error when looking for none existing records") + if DB.Where("name = ?", "none existing").Find(&[]User{}).RecordNotFound() { + t.Errorf("Should not get RecordNotFound error when looking for none existing records") } }