From a80a0a16364b7e47a2e63fe64ca95df76e7fa185 Mon Sep 17 00:00:00 2001 From: Jinzhu Date: Wed, 20 Aug 2014 13:46:10 +0800 Subject: [PATCH] By default, pluralize table name --- scope.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scope.go b/scope.go index 9eb672ad..18d36501 100644 --- a/scope.go +++ b/scope.go @@ -204,7 +204,7 @@ func (scope *Scope) TableName() string { str := ToSnake(data.Type().Name()) - if scope.db != nil && !scope.db.parent.singularTable { + if scope.db == nil || !scope.db.parent.singularTable { for index, reg := range pluralMapKeys { if reg.MatchString(str) { return reg.ReplaceAllString(str, pluralMapValues[index])