remove redundancy in models BeforeInsert hook

This commit is contained in:
dhax 2017-10-13 01:01:31 +02:00
parent c3271d7dcf
commit 2dc0f02d1c
2 changed files with 2 additions and 8 deletions

View file

@ -25,11 +25,8 @@ func (p *Profile) BeforeInsert(db orm.DB) error {
// BeforeUpdate hook executed before database update operation.
func (p *Profile) BeforeUpdate(db orm.DB) error {
if err := p.Validate(); err != nil {
return err
}
p.UpdatedAt = time.Now()
return nil
return p.Validate()
}
// Validate validates Profile struct and returns validation errors.