about summary refs log tree commit diff
path: root/app/models/user.rb
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2017-06-08 15:22:01 +0200
committerMatt Jankowski <mjankowski@thoughtbot.com>2017-06-08 09:22:01 -0400
commitc207b4bb330463c39c202d1c66e2447b55332093 (patch)
tree932150591bd43dc2c4b3490f9be29132911b1bf6 /app/models/user.rb
parentb87eb8ea146a54fcfd2533f47622070d0f30a9fa (diff)
Fix db:seed - only run some validations when the field was changed (#3592)
* Fix db:seed - only run some validations when the field was changed

* Add tests
Diffstat (limited to 'app/models/user.rb')
-rw-r--r--app/models/user.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index c0600fe75..0fd3983b4 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -47,7 +47,7 @@ class User < ApplicationRecord
   accepts_nested_attributes_for :account
 
   validates :locale, inclusion: I18n.available_locales.map(&:to_s), if: :locale?
-  validates :email, email: true
+  validates :email, email: true, if: :email_changed?
 
   scope :recent,    -> { order(id: :desc) }
   scope :admins,    -> { where(admin: true) }