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
This commit is contained in:
parent
b87eb8ea14
commit
c207b4bb33
5 changed files with 23 additions and 6 deletions
|
@ -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) }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue