Find Field by db name also

This commit is contained in:
Jinzhu 2015-06-04 12:10:09 +08:00
parent 3d20aafa40
commit 0b8c9f29a9
1 changed files with 1 additions and 1 deletions

View File

@ -273,7 +273,7 @@ func (scope *Scope) CombinedConditionSql() string {
func (scope *Scope) FieldByName(name string) (field *Field, ok bool) { func (scope *Scope) FieldByName(name string) (field *Field, ok bool) {
for _, field := range scope.Fields() { for _, field := range scope.Fields() {
if field.Name == name { if field.Name == name || field.DBName == name {
return field, true return field, true
} }
} }