summaryrefslogtreecommitdiff
path: root/app/models/email.rb
diff options
context:
space:
mode:
authorSemyon Pupkov <semen.pupkov@gmail.com>2016-05-23 14:19:27 +0500
committerSemyon Pupkov <mail@semyonpupkov.com>2016-10-23 17:30:07 +0500
commitb1ce2eb1e5f6a4a5b413381489fbb7e63ff3e1e5 (patch)
treee534764412d32517b1e7e06e86b0516025472311 /app/models/email.rb
parenta98ad03ba18da0b1534f36dafafa9a1c644d0bf1 (diff)
downloadgitlab-ce-b1ce2eb1e5f6a4a5b413381489fbb7e63ff3e1e5.tar.gz
refactor(email): use setter method instead AR callbacks
Diffstat (limited to 'app/models/email.rb')
-rw-r--r--app/models/email.rb6
1 files changed, 2 insertions, 4 deletions
diff --git a/app/models/email.rb b/app/models/email.rb
index 32a412ab878..826d4f16edb 100644
--- a/app/models/email.rb
+++ b/app/models/email.rb
@@ -7,10 +7,8 @@ class Email < ActiveRecord::Base
validates :email, presence: true, uniqueness: true, email: true
validate :unique_email, if: ->(email) { email.email_changed? }
- before_validation :cleanup_email
-
- def cleanup_email
- self.email = self.email.downcase.strip
+ def email=(value)
+ write_attribute(:email, value.downcase.strip)
end
def unique_email