diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-04-02 21:02:02 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-04-02 21:02:02 +0300 |
commit | 599344583bcf57eff46b36d68e6536188d41c906 (patch) | |
tree | c3b8e0226688d4d1c22fdb159b57417386b7c74f /app/models/email.rb | |
parent | 3faa14e7a748097528ed36cf02ccacd62cd8f044 (diff) | |
download | gitlab-ce-599344583bcf57eff46b36d68e6536188d41c906.tar.gz |
Remove EmailsObserver
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/models/email.rb')
-rw-r--r-- | app/models/email.rb | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/app/models/email.rb b/app/models/email.rb index 22e71e4f107..b92c1841063 100644 --- a/app/models/email.rb +++ b/app/models/email.rb @@ -13,14 +13,15 @@ class Email < ActiveRecord::Base # Relations # belongs_to :user - + # # Validations # validates :user_id, presence: true validates :email, presence: true, email: { strict_mode: true }, uniqueness: true validate :unique_email, if: ->(email) { email.email_changed? } - + + after_create :notify before_validation :cleanup_email def cleanup_email @@ -30,4 +31,8 @@ class Email < ActiveRecord::Base def unique_email self.errors.add(:email, 'has already been taken') if User.exists?(email: self.email) end -end
\ No newline at end of file + + def notify + NotificationService.new.new_email(self) + end +end |