FIX: Validate user email only once (#12327)
It was validated twice: once by validates_associated and once by has_many.
This commit is contained in:
parent
990a26d14b
commit
92ad2182f5
|
@ -40,7 +40,7 @@ class User < ActiveRecord::Base
|
|||
|
||||
has_one :user_option, dependent: :destroy
|
||||
has_one :user_avatar, dependent: :destroy
|
||||
has_one :primary_email, -> { where(primary: true) }, class_name: 'UserEmail', dependent: :destroy, autosave: true
|
||||
has_one :primary_email, -> { where(primary: true) }, class_name: 'UserEmail', dependent: :destroy, autosave: true, validate: false
|
||||
has_one :user_stat, dependent: :destroy
|
||||
has_one :user_profile, dependent: :destroy, inverse_of: :user
|
||||
has_one :single_sign_on_record, dependent: :destroy
|
||||
|
|
|
@ -90,7 +90,7 @@ describe User do
|
|||
user.email = 'test@gmailcom'
|
||||
|
||||
expect(user).to_not be_valid
|
||||
expect(user.errors.messages).to include(:primary_email)
|
||||
expect(user.errors.messages.keys).to contain_exactly(:primary_email)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue