By default, pluralize table name

This commit is contained in:
Jinzhu 2014-08-20 13:46:10 +08:00
parent 14fdbdd965
commit a80a0a1636
1 changed files with 1 additions and 1 deletions

View File

@ -204,7 +204,7 @@ func (scope *Scope) TableName() string {
str := ToSnake(data.Type().Name()) 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 { for index, reg := range pluralMapKeys {
if reg.MatchString(str) { if reg.MatchString(str) {
return reg.ReplaceAllString(str, pluralMapValues[index]) return reg.ReplaceAllString(str, pluralMapValues[index])